diff --git a/update.sh b/update.sh index c7cbd88..93c5eb7 100644 --- a/update.sh +++ b/update.sh @@ -14,12 +14,16 @@ fi # get OS ditro and version OS=$(hostnamectl | awk '/Operating System/ {print $3}') +VM=true if [ ${OS} == 'Ubuntu' ]; then OS_VER=$(hostnamectl | awk '/Operating System/ {print $4}') else OS_VER=$(hostnamectl | awk '/Operating System/ {print $5}') fi +if [ $(hostnamectl | awk '/Virtualization/ {print $2}') == 'vmware' ]; then + VM=false + # Debian OS if [ ${OS} == 'Debian' ] || [ ${OS} == 'Ubuntu' ]; then # upgrade all packages @@ -38,7 +42,11 @@ if [ ${OS} == 'Debian' ] || [ ${OS} == 'Ubuntu' ]; then apt update # install the packages on all systems - apt install -y pbis-open sudo nano htop nload iperf iperf3 open-vm-tools unattended-upgrades unzip git nfs-common uptimed net-tools build-essential curl + 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 # remove unneeded packages apt autoremove -y @@ -71,8 +79,12 @@ elif [ ${OS} == 'CentOS' ]; then # Centos 7 if [[ ${OS_VER} =~ ^7.* ]]; then # install the packages - yum install -y pbis-open sudo nano htop nload iperf iperf3 bind-utils open-vm-tools yum-cron unzip nfs-utils git wget uptimed net-tools make + 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 + # modify yum-cron config to auto install security updates and enable/start the service sed --in-place "s/^update_cmd\ =\ security/update_cmd\ =\ default/" /etc/yum/yum-cron.conf sed --in-place "s/^apply_updates\ =\ no/apply_updates\ =\ yes/" /etc/yum/yum-cron.conf @@ -88,7 +100,12 @@ elif [ ${OS} == 'CentOS' ]; then # install the packages # libnsl is needed for pbis and needs to be installed already dnf install -y libnsl - dnf install -y libnsl pbis-open sudo nano htop iperf3 bind-utils open-vm-tools unzip nfs-utils git wget net-tools make + 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 + # https://github.com/BeyondTrust/pbis-open/issues/242 cp /opt/pbis/share/rhel/8.0/pbis.pp /opt/pbis/share/ fi