diff --git a/update.sh b/update.sh index 8324779..9acc325 100644 --- a/update.sh +++ b/update.sh @@ -15,20 +15,20 @@ fi # get OS ditro and version OS=$(hostnamectl | awk '/Operating System/ {print $3}') VM=$(hostnamectl | awk '/Virtualization/ {print $2}') -if [ "${OS}" == 'Ubuntu' ]; then +if [ "${OS}" == "Ubuntu" ]; then OS_VER=$(hostnamectl | awk '/Operating System/ {print $4}') else OS_VER=$(hostnamectl | awk '/Operating System/ {print $5}') fi -if [ "${VM}" == 'vmware' ]; then - VM='true' +if [ "${VM}" == "vmware" ]; then + VM="true" else - VM='false' + VM="false" fi # Debian OS -if [ ${OS} == 'Debian' ] || [ ${OS} == 'Ubuntu' ]; then +if [ ${OS} == "Debian" ] || [ ${OS} == "Ubuntu" ]; then # upgrade all packages apt update; apt upgrade -y @@ -48,8 +48,8 @@ if [ ${OS} == 'Debian' ] || [ ${OS} == 'Ubuntu' ]; then apt install -y pbis-open sudo nano htop nload iperf iperf3 unattended-upgrades unzip git nfs-common uptimed net-tools build-essential curl # install vm tools - if [ ${VM} == 'true' ]; then - apt install open-vm-tools + if [ "${VM}" == "true" ]; then + apt install -y open-vm-tools fi # remove unneeded packages @@ -64,7 +64,7 @@ if [ ${OS} == 'Debian' ] || [ ${OS} == 'Ubuntu' ]; then update-ca-certificates # CentOS OS -elif [ ${OS} == 'CentOS' ]; then +elif [ "${OS}" == "CentOS" ]; then # upgrade all packages yum update -y @@ -81,13 +81,13 @@ elif [ ${OS} == 'CentOS' ]; then yum autoremove -y # Centos 7 - if [[ ${OS_VER} =~ ^7.* ]]; then + if [[ "${OS_VER}" =~ "^7.*" ]]; then # install the packages yum install -y pbis-open sudo nano htop nload iperf iperf3 bind-utils yum-cron unzip nfs-utils git wget uptimed net-tools make # install vm tools - if [ ${VM} == 'true' ]; then - yum install open-vm-tools + if [ "${VM}" == "true" ]; then + yum install -y open-vm-tools fi # modify yum-cron config to auto install security updates and enable/start the service @@ -101,15 +101,15 @@ elif [ ${OS} == 'CentOS' ]; then systemctl enable uptimed fi # Centos 7 - if [[ ${OS_VER} =~ ^8.* ]]; then + if [ "${OS_VER}" =~ "^8.*" ]]; then # install the packages # libnsl is needed for pbis and needs to be installed already dnf install -y libnsl dnf install -y pbis-open sudo nano htop iperf3 bind-utilsunzip nfs-utils git wget net-tools make # install vm tools - if [ ${VM} == 'true' ]; then - dnf install open-vm-tools + if [ "${VM}" == "true" ]; then + dnf install -y open-vm-tools fi # https://github.com/BeyondTrust/pbis-open/issues/242