Add system requirement cheks.
This commit is contained in:
@ -25,6 +25,42 @@ if [[ $PYTHON_CONFIRM != "y" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check other system requirements
|
||||
echo "Checking other system requirements..."
|
||||
RAM=$(free -m | awk '/Mem/ {print $2}')
|
||||
CPU=$(grep -c ^processor /proc/cpuinfo)
|
||||
DISK=$(df -h / | awk 'NR==2 {print $4}')
|
||||
MIN_RAM=2048 # Minimum RAM in MB
|
||||
MIN_CPU=2 # Minimum CPU cores
|
||||
MIN_DISK=10 # Minimum free disk space in GB
|
||||
|
||||
# Check RAM
|
||||
if [ "$RAM" -lt "$MIN_RAM" ]; then
|
||||
echo "Error: Insufficient RAM. At least $MIN_RAM MB of RAM is required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check CPU cores
|
||||
if [ "$CPU" -lt "$MIN_CPU" ]; then
|
||||
echo "Error: Insufficient CPU cores. At least $MIN_CPU CPU cores are required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check disk space
|
||||
DISK_NUM=$(echo "$DISK" | grep -o -E '[0-9]+')
|
||||
DISK_UNIT=$(echo "$DISK" | grep -o -E '[A-Za-z]+')
|
||||
if [ "$DISK_UNIT" == "G" ]; then
|
||||
if [ "$DISK_NUM" -lt "$MIN_DISK" ]; then
|
||||
echo "Error: Insufficient disk space. At least $MIN_DISK GB of free disk space is required."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: Unsupported disk space unit. Please ensure disk space is in GB."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "System meets minimum requirements. Proceeding with installation..."
|
||||
|
||||
# Add Netbox repository
|
||||
echo "Adding Netbox repository..."
|
||||
echo "deb https://packagecloud.io/netbox-community/netbox/ubuntu/ $(lsb_release -sc) main" | tee -a /etc/apt/sources.list.d/netbox-community.list
|
||||
|
Reference in New Issue
Block a user