Fixed OS and memory check

This commit is contained in:
Derek Crudgington 2023-03-21 16:04:35 +00:00
parent 88450d0a9a
commit 22c30eed0c

View File

@ -188,8 +188,7 @@ check_ports() {
# Check if ss command exists # Check if ss command exists
if command -v ss &> /dev/null; then if command -v ss &> /dev/null; then
# Check every port we need if it's in use # Check every port we need if it's in use
#for i in 25 53 80 143 389 587 993 8000; do for i in 25 53 80 143 389 587 993 8000; do
for i in 8734; do
SS=`ss -tulwn | grep LISTEN | awk '{ print $5 }' | awk -F: '{ print $NF }' | grep "^$i$" | head -1` SS=`ss -tulwn | grep LISTEN | awk '{ print $5 }' | awk -F: '{ print $NF }' | grep "^$i$" | head -1`
# If port 53 (dns) in use by system-resolvd (Ubuntu) then auto fix # If port 53 (dns) in use by system-resolvd (Ubuntu) then auto fix
if [ "$SS" == 53 ]; then if [ "$SS" == 53 ]; then
@ -226,20 +225,22 @@ check_ports() {
fi fi
} }
check_os() { check_os() {
OSRELEASE=`grep "VERSION=" /etc/os-release | awk -F\" '{ print $2 }'` OSRELEASE=`grep "VERSION_ID=" /etc/os-release | awk -F\" '{ print $2 }'`
if [ "$OSRELEASE" != "22.04 LTS (Jammy Jellyfish)" ]; then if [ "$OSRELEASE" != "22.04" ]; then
echo -ne "\nFederated requires a minimum of 4G of RAM and 25G of storage\n \ echo -ne "\nFederated requires a minimum of 4G of RAM and 25G of storage\n \
running Ubuntu 22.04 LTS. Your system is not supported. Please contact\n \ running Ubuntu 22.04 LTS. Your system is not supported. Please contact\n \
Federated @ support@federated.computer for assistance or choose our\n \ Federated @ support@federated.computer for assistance or choose our\n \
cloud offerings at https://cloud.federated.computer.\n\n" cloud offerings at https://cloud.federated.computer.\n\n"
exit 2;
fi fi
} }
check_memory() { check_memory() {
MEMTOTAL=`awk '/MemTotal/ { printf "%.3d \n", $2/1024 }' /proc/meminfo` MEMTOTAL=`awk '/MemTotal/ { printf "%.3d \n", $2/1024 }' /proc/meminfo`
if [ "$MEMTOTAL" -lt "3900" ]; then if [ "$MEMTOTAL" -lt "3700" ]; then
echo -ne "\nFederated requires a minimum of 4G of RAM and 25G of storage\n \ echo -ne "\nFederated requires a minimum of 4G of RAM and 25G of storage\n \
running Ubuntu 22.04 LTS. Your system is not supported. Please contact\n \ running Ubuntu 22.04 LTS. Your system is not supported. Please contact\n \
Federated @ support@federated.computer for assistance or choose our\n \ Federated @ support@federated.computer for assistance or choose our\n \
cloud offerings at https://cloud.federated.computer.\n\n" cloud offerings at https://cloud.federated.computer.\n\n"
exit 2;
fi fi
} }