#!/bin/bash
#Check Internet Connection
echo -n "Checking Internet Connection..."
ping 8.8.8.8 -c 5 > /dev/null 2>&1 && echo "OK" || { echo "FAILED" && exit; }
#Download and Install the latest Updates for the OS
echo "Updating OS..."
(apt update && apt full-upgrade) > /dev/null 2>&1 && echo "OK" || echo "FAILED"
packageInstalled () {
numberOfPackages=`apt list --installed | grep $1 | wc -l`
if [ "$numberOfPackages" -gt "0" ];
then
echo "Nginx ALREADY EXISTED" && nginx -v
else
echo "Installing NGINX package From a Default Ubuntu Repository ${NGINXVersion}"
apt -y install $1 > /dev/null 2>&1 && echo "Success" || echo "Failure"
fi
}
packageInstalled nginx-extras