#!/usr/bin/env bash # LinUPx - Linux Update Scripts action="$1" FOLDER='/opt/idssys/linupx' VERS='5.86-05022023' if [ -d /opt/idssys/settings ]; then [ $(ls /opt/idssys/settings | wc -l) -eq 0 ] && rm -rf /opt/idssys/settings fi if [ -d /opt/idssys/LinUPx ]; then mv /opt/LinUPx /opt/idssys/linupx rm -f /usr/local/bin/runup ln -s /opt/idssys/linupx/run.sh /usr/local/bin/runup echo "Program has been updated, please re-run" exit 0 fi if [ ! -d "/opt/idssys/linupx" ]; then if [ ! -d /opt/idssys ]; then mkdir /opt/idssys fi mv /opt/LinUPx /opt/idssys/linupx rm -f /usr/local/bin/runup ln -s /opt/idssys/linupx/run.sh /usr/local/bin/runup echo "Program has been updated, please re-run" exit 0 fi if [ ! -d "/opt/idssys/defaults" ]; then set -eu git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults fi [ "$(dpkg-query -W --showformat='${Status}\n' grepcidr | grep "install ok installed")" == "" ] && sudo apt -y install grepcidr >/dev/null 2>&1 source /opt/idssys/linupx/settings.conf source /opt/idssys/defaults/colors.inc source /opt/idssys/defaults/default.inc Color_Off='\033[0m' Blue='\033[0;34m' BBlue='\033[1;34m' Green='\033[0;32m' LGreen='\033[1;32m' BOrange='\033[0;33m' DGray='\033[1;30m' Red='\033[10;31m' LRed='\033[1;31m' UPDATE1() { if [ "$opennms" = true ]; then sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db fi if type yum &>/dev/null; then $APTFUNC -y update else [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE $APTFUNC update $APTFUNC upgrade -y echo read -n 1 -p "Would you like to run dist-upgrade as well (Y/n)?" choice echo case "$choice" in [Yy]) $APTFUNC dist-upgrade;; esac [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE fi if [ "$opennms" = true ]; then sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db fi touch "${FOLDER}/lastrun" echo "" echo -e "${Green}Updates have completed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" } UPDATE2() { if [ "$opennms" = true ]; then sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db fi [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE $APTFUNC upgrade -y echo read -n 1 -p "Would you like to run dist-upgrade as well (Y/n)?" choice echo case "$choice" in [Yy]) $APTFUNC dist-upgrade;; esac [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE if [ "$opennms" = true ]; then sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db fi touch "${FOLDER}/lastrun" echo "" echo -e "${Green}Updated Upgrades have completed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" } UPDATE3() { restart_flag=''; export DEBIAN_FRONTEND="noninteractive" source /etc/environment bash /etc/skel/.profile while getopts 'r' flag; do case "${flag}" in r) restart_flag='true' ;; esac done if [ "$autorun_logging" = true ]; then mv -f /opt/runupdates.log.2 /opt/runupdates.log.3 mv -f /opt/runupdates.log.1 /opt/runupdates.log.2 mv -f /opt/runupdates.log /opt/runupdates.log.1 fi if type yum &>/dev/null; then yum -y update &>> /opt/runupdates.log else if [ "$opennms" = true ]; then sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db fi if [ "$useAutoremove" -ne 0 ]; then apt-get -y autoremove &>> /opt/runupdates.log apt-get update &>> /opt/runupdates.log apt-get upgrade -y &>> /opt/runupdates.log apt-get -y autoremove &>> /opt/runupdates.log fi if [ "$opennms" = true ]; then sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db fi fi touch "${FOLDER}/lastrun" echo "" echo -e "${Green}Updates have completed${Color_Off}" if [ "$autorun_restart_after" = true ] || [ "$restart_flag" = true ]; then echo -e "${BOrange}Rebooting now...${Color_Off}" sleep 3 /sbin/shutdown -r now fi exit 0 } UPDATE4() { restart_flag=''; while getopts 'r' flag; do case "${flag}" in r) restart_flag='true' ;; esac done if type yum &>/dev/null; then yum -y update else if [[ "$useAutoremove" -ne 0 ]]; then apt-get -y autoremove apt-get update apt-get upgrade -y apt-get -y autoremove fi fi touch "${FOLDER}/lastrun" echo "" echo -e "${Green}Updates have completed${Color_Off}" if [ "$autorun_restart_after" = true ] || [ "$restart_flag" = true ]; then echo -e "${BOrange}Rebooting now...${Color_Off}" sleep 3 /sbin/shutdown -r now fi exit 0 } DISTUPGRADE() { if type yum &>/dev/null; then $APTFUNC upgrade else $APTFUNC dist-upgrade fi if [ "$useAutoremove" -ne 0 ] && type apt-get &>/dev/null; then AUTOREMOVE fi echo "" echo -e "${Green}Dist Upgrades has completed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" } PIPUPGRADE() { if ! command -v jq &> /dev/null then $APTFUNC install jq -y fi if [ "$EUID" -ne 0 ]; then sudo python3 -m pip install --upgrade pip sudo pip3 list --outdated --format=json | jq -r '.[] | "\(.name)==\(.latest_version)"' | xargs -n1 pip3 install -U else python3 -m pip install --upgrade pip pip3 list --outdated --format=json | jq -r '.[] | "\(.name)==\(.latest_version)"' | xargs -n1 pip3 install -U fi echo "" echo -e "${Green}Python-Pip Upgrades has completed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" } DNSUPDATE() { bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/update-dns.sh) echo "" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" } AUTOREMOVE() { if [[ "$useAutoremove" -ne 0 ]]; then if [ "$EUID" -ne 0 ]; then sudo apt-get autoremove else apt-get autoremove fi fi } DRYRUN1() { if type apt &>/dev/null; then $APTFUNC update $APTFUNC list --upgradable elif type apt-get &>/dev/null; then $APTFUNC update $APTFUNC upgrade --dry-run elif type yum &>/dev/null; then $APTFUNC check-update fi echo "" echo -e "${Green}Upgrade dry-run has completed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" } DRYRUN2() { if type yum &>/dev/null; then $APTFUNC --obsoletes check-update else $APTFUNC dist-upgrade --dry-run fi echo "" echo -e "${Green}Dist-Upgrade dry-run has completed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" } GO_REBOOT() { read -n 1 -p "Are you sure you wish to reboot (y/N)?" choice case "$choice" in [Yy]) if [ "$EUID" -ne 0 ]; then sudo shutdown -r now else shutdown -r now fi echo 'The system is now rebooting...' sleep 60 exit 0;; * ) SCRIPT_MENU;; esac } SHUTDOWN() { read -n 1 -p "Are you sure you wish to shutdown (y/N)?" choice case "$choice" in [Yy]) if [ "$EUID" -ne 0 ]; then sudo shutdown -h now else shutdown -h now fi echo 'The system is now shutting down...' sleep 60 exit 0;; * ) SCRIPT_MENU;; esac } ENDISASU() { if [ "$EUID" -ne 0 ]; then sudo dpkg-reconfigure --priority=low unattended-upgrades else dpkg-reconfigure --priority=low unattended-upgrades fi } EXIT1() { clear exit 0 } WEBMIN_INSTALL() { read -n 1 -p "Are you sure you wish to install Webmin (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-webmin.sh) echo "" echo -e "${Green}Webmin has been Installed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } GLANCES_INSTALL() { read -n 1 -p "Are you sure you wish to install Glances (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-glances.sh) echo "" echo -e "${Green}Glances has been Installed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } MYSQLBU_INSTALL() { read -n 1 -p "Are you sure you wish to install MySQL-BU (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-mysqlbu.sh) echo "" echo -e "${Green}MySQL-BU has been Installed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } DSMON_INSTALL() { read -n 1 -p "Are you sure you wish to install DSMon (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/install-dsmon.sh) echo "" echo -e "${Green}DSMon has been Installed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } REMOVEFLOPPY() { echo "" if [ ! -f /etc/modprobe.d/blacklist-floppy.conf ]; then echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf sudo rmmod floppy sudo update-initramfs -u echo echo -e "${Green}Floppy has been removed, you must reboot to take effect.${Color_Off}" echo read -e -n 1 -p $'\e[1;31mWould you like to reboot now (y/N)?\e[0m' choice case "$choice" in [Yy]) echo echo echo -e "${BOrange}The system is now rebooting...${Color_Off}" if [ "$EUID" -ne 0 ]; then sudo shutdown -r now else shutdown -r now; fi sleep 60 exit 0;; * ) SCRIPT_MENU;; esac else echo -e "${Green}Floppy has already been removed.${Color_Off}" echo read -n 1 -s -p "Press any key to continue" fi } NETDATA_INSTALL() { if service_exists netdata; then read -n 1 -p "Netdata is already installed, would you like to remove it (y/N)?" choice case "$choice" in [Yy]) echo wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall apt remove --purge netdata netdata-repo-edge -y rm -Rf /var/cache/netdata /var/lib/netdata /etc/logrotate.d/netdata /etc/default/netdata /etc/netdata /etc/init.d/netdata /etc/systemd/system/netdata.service /etc/systemd/system/multi-user.target.wants/netdata.service systemctl daemon-reload echo echo -e "${Green}Netdata Agent has been Removed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; * ) INSTALL_MENU;; esac else read -n 1 -p "Are you sure you wish to install Netdata Agent (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token GKUQidqs3HAdWdyLgYjjHpI6k0W09TPxv4hyEvESuNKF9Xy0SKBvOr7BokNZHn6j7GUHlfc_R8UQp-dEXPAoRHdEmbSRCGOXX4XiOfMRazUk6Dd_3qjIdqJu9YqDaL2jw1hSTzw --claim-url https://app.netdata.cloud echo "" echo -e "${Green}Netdata Agent has been Installed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac fi } NETDATA_UNINSTALL(){ sudo killall netdata sudo wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall --non-interactive sudo systemctl stop netdata sudo systemctl disable netdata sudo systemctl unmask netdata sudo rm -rf /lib/systemd/system/netdata.service sudo rm -rf /lib/systemd/system/netdata-updater.service sudo rm -rf /lib/systemd/system/netdata-updater.timer sudo rm -rf /etc/logrotate.d/netdata sudo /usr/libexec/netdata/netdata-uninstaller.sh --yes --env /etc/netdata/.environment sudo apt --purge remove netdata -y sudo rm /usr/lib/netdata* -R sudo rm /var/lib/apt/lists/packagecloud.io_netdata_* -R sudo rm /etc/init.d/netdata sudo rm /etc/rc0.d/K01netdata sudo rm /etc/rc1.d/K01netdata sudo rm /etc/rc2.d/K01netdata sudo rm /etc/rc3.d/K01netdata sudo rm /etc/rc4.d/K01netdata sudo rm /etc/rc5.d/K01netdata sudo rm /etc/rc6.d/K01netdata sudo rm /etc/rc0.d/S01netdata sudo rm /etc/rc1.d/S01netdata sudo rm /etc/rc2.d/S01netdata sudo rm /etc/rc3.d/S01netdata sudo rm /etc/rc4.d/S01netdata sudo rm /etc/rc5.d/S01netdata sudo rm /etc/rc6.d/S01netdata sudo rm /usr/sbin/netdata sudo rm -rf /var/lib/dpkg/info/netdata* -R sudo rm -rf /var/lib/apt/lists/packagecloud.io_netdata* -R sudo rm -rf /usr/share/netdata -R sudo rm -rf /usr/share/doc/netdata* -R sudo rm /usr/share/lintian/overrides/netdata* sudo rm /usr/share/man/man1/netdata.1.gz sudo rm /var/lib/systemd/deb-systemd-helper-enabled/netdata.service.dsh-also sudo rm /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/netdata.service sudo rm /var/lib/systemd/deb-systemd-helper-masked/netdata.service sudo rm -rf /usr/lib/netdata -R sudo rm -rf /etc/rc2.d/S01netdata -R sudo rm -rf /etc/rc3.d/S01netdata -R sudo rm -rf /etc/rc4.d/S01netdata -R sudo rm -rf /etc/rc5.d/S01netdata -R sudo rm -rf /etc/default/netdata -R sudo rm -rf /etc/apt/sources.list.d/netdata.list sudo rm -rf /etc/apt/sources.list.d/netdata-edge.list sudo rm -rf /etc/apt/trusted.gpg.d/netdata-archive-keyring.gpg sudo rm -rf /etc/apt/trusted.gpg.d/netdata-edge-archive-keyring.gpg sudo rm -rf /etc/apt/trusted.gpg.d/netdata-repoconfig-archive-keyring.gpg sudo rm -rf /SM_DATA/sm_virt_machines/media/netdata-uninstaller.sh sudo rm -rf /SM_DATA/sm_virt_machines/media/netdata* sudo rm -rf /SM_DATA/working/netdata-kickstart* sudo rm -rf /usr/share/lintian/overrides/netdata sudo rm -rf /var/cache/apt/archives/netdata* sudo rm -rf /opt/netdata* sudo rm -rf /etc/cron.daily/netdata-updater sudo rm -rf /usr/libexec/netdata -R sudo rm -rf /var/log/netdata -R sudo rm -rf /var/cache/netdata -R sudo rm -rf /var/lib/netdata -R sudo rm -rf /etc/netdata -R sudo rm -rf /opt/netdata -R systemctl daemon-reload } IPERF_INSTALL() { read -n 1 -p "Are you sure you wish to install iPerf (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" cd /tmp wget https://downloads.es.net/pub/iperf/iperf-3.10.1.tar.gz tar -zxhf iperf-3.10.1.tar.gz cd /tmp/iperf-3.10.1 ./configure make make install ldconfig echo "" echo -e "${Green}iPerf has been Installed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } CHANGECOPYCERTS_INSTALL() { read -n 1 -p "Are you sure you wish to change SSL servers (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" ssh-copy-id le@keepalived.scity.us echo sed -i 's/scp le@webserver.scity.us:\/etc\/letsencrypt\/live/scp le@keepalived.scity.us:\/opt\/nginx-proxy\/ssl/' /opt/copycerts.sh sed -i 's/scp -pr le@webserver.scity.us:\/etc\/letsencrypt\/live/scp -pr le@keepalived.scity.us:\/opt\/nginx-proxy\/ssl/' /opt/copycerts.sh /opt/copycerts.sh echo "" echo -e "${Green}copycerts.sh has been updated${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } SPEEDTEST_INSTALL() { read -n 1 -p "Are you sure you wish to install SpeedTest (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" $APTFUNC remove -y -qq speedtest speedtest-cli >/dev/null 2&>1 pip uninstall speedtest speedtest-cli -y >/dev/null 2&>1 rm /usr/local/bin/speedtest-cli >/dev/null 2&>1 curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash $APTFUNC install -y speedtest echo "" echo -e "${Green}SpeedTest has been Installed${Color_Off}" echo "" echo -e "${LightCyan}To run, use the command: speedtest${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } URBACKUP_INSTALL() { read -n 1 -p "Are you sure you wish to install Urbackup Client (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" read -p "Enter ClientID:" clientid echo "" read -p "Enter Auth Key:" authkey TF=`mktemp` wget "http://urbackup.scity.us:55414/x?a=download_client&lang=en&clientid=${clientid}&authkey=${authkey}&os=linux" -O $TF sudo sh $TF rm -f $TF echo "" echo -e "${Green}UrBackup Client has been Installed${Color_Off}" echo "" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } X11VNC_INSTALL() { read -n 1 -p "Are you sure you wish to install x11vnc (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-vnc.sh) echo "" echo -e "${Green}x11vnc has been Installed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue";; esac } LINUPX_UNINSTALL() { read -n 1 -p "Are you sure you wish to remove LinUPx (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/uninstall-linupx.sh) exit 0;; esac } FW_INSTALL() { read -n 1 -p "Are you sure you wish to install Filewatcher (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo "" bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-filewatcher.sh) exit 0;; esac } ENABLE_REMOTESYSLOG(){ read -n 1 -p "Are you sure you wish to enable sending syslogs to ${RemoteSyslogServer} (Y/n)?" choice case "$choice" in [Nn]) SCRIPT_MENU;; * ) echo "" echo -e "\n\n*.* @${RemoteSyslogServer}:514" >> /etc/rsyslog.d/50-default.conf service rsyslog restart SCRIPT_MENU;; esac } PYTHON3UPGRADE(){ read -n 1 -p "Are you sure you wish to upgrade to Python3 (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) add-apt-repository -y ppa:deadsnakes/ppa $APTFUNC install -y python3.10 python3-pip update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2 update-alternatives --config python3 echo "" echo -e "${Green}Python3.10 Upgrade has been Completed${Color_Off}" if [ ${action-x} ]; then exit 0; fi read -n 1 -s -p "Press any key to continue" SCRIPT_MENU;; esac } POSTFIX_INSTALL(){ bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-postfix.sh) echo "" read -n 1 -s -p "Press any key to continue" INSTALL_MENU } BASHRC_INSTALL(){ echo -e "${Green}Installing root/.bashrc${Color_Off}" /usr/bin/wget -O ~/.bashrc https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/bashrc read -n 1 -s -p "Press any key to continue" INSTALL_MENU } MPVMFIX(){ echo -e " blacklist { device { vendor \"VMware\" product \"Virtual disk\" } } " >> /etc/multipath.conf /etc/init.d/multipath-tools restart } ADDVEEAMUSER(){ bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/add-veeam-user.sh) echo "" } COPYCERTS_UPDATE(){ if [ -f /opt/copycerts.sh ]; then /usr/bin/ssh-copy-id le@keepalived.scity.us /bin/sed -i 's/le@keepalived.scity.us\:\/opt\/nginx-proxy\/ssl/le@keepalived.scity.us\:\/opt\/lb-data\/letsencrypt\/live/g' /opt/copycerts.sh /opt/copycerts.sh echo "" echo -e "${Green}copycerts.sh has been updated${Color_Off}" else echo -e "${Blue}copycerts.sh not found${Color_Off}" fi [ ${1-x} ] && exit 0 || read -n 1 -s -p "Press any key to continue" } SCRIPT_MENU() { if [ -f ${FOLDER}/lastrun ]; then LASTRUND=$(stat -c %y ${FOLDER}/lastrun | cut -d ' ' -f1) LASTRUNT=$((stat -c %y ${FOLDER}/lastrun | cut -d ' ' -f2) | cut -d '.' -f1) else LASTRUND='never' LASTRUNT='' fi while : do clear echo "" echo -e " ${LGreen}LinUPx - L I N U X U P D A T E S C R I P T S${Color_Off} ${DGray}(ver-${VERS})${Color_Off}" echo -e "${LGreen}---------------------------------------------------------------------------${Color_Off}" echo -e "Hostname: ${BBlue}$(hostname -s)${Color_Off}" echo -e "Domain: ${BBlue}$(hostname -d)${Color_Off}" echo "" echo -e "Last run: ${Green}${LASTRUND} ${LASTRUNT}${Color_Off}" echo "---------------------------------------------------------------------------" OS=($(detect_os)) width=14 printf "%-${width}s: %s\n" "Machine" "${OS[0]}" printf "%-${width}s: %s\n" "Distribution" "${OS[1]}" printf "%-${width}s: %s\n" "Derivative" "${OS[2]}" printf "%-${width}s: %s\n" "Version" "${OS[3]}" printf "%-${width}s: %s\n" "Codename/Rev" "${OS[4]}" echo -e "${LGreen}---------------------------------------------------------------------------${Color_Off}" echo "" echo " [1] Check for Updates/Upgrades" echo "*[2] Run Updates" if [ "$ATYPE" != 'yum' ]; then echo " [3] Run Updates w/o updating repos" fi echo echo " [4] Check for Upgrades with obsoletes enabled" echo " [5] Run Dist-Upgrade" echo "*[6] Run Python-Pip Upgrades" echo echo " [7] Remove Floppy from VM" echo " [8] Fix multipath/vmware issue" echo if [ "$(IP_ALLOWED `hostname -I`)" == "true" ]; then echo " [U] Update copycerts.sh SSL server" echo " [D] Update DNS (10.10.10.10, 10.10.10.11)" echo " [C] Change copycerts to LB-Nodes" echo " [P] Upgrade to Python v3" echo " [V] Add Veeam User Account" echo fi if [ "$ATYPE" != 'yum' ]; then echo " [0] Enable/Disable Automatic Security Updates" echo "" fi echo " [I] Installation Scripts" echo "" # echo " [L] Enable Remote Syslog" # echo " [Config file: RemoteSyslogServer=${RemoteSyslogServer}]" # echo "" echo " [R] Reboot System" echo " [S] Shutdown System" echo " [Q] Quit" echo "" echo "" echo -e -n "${BOrange}Please select an [ActionItem] from above:${Color_Off} " read -n 1 opt echo "" case $opt in 1) DRYRUN1 SCRIPT_MENU;; 2) UPDATE1 SCRIPT_MENU;; 3) UPDATE2 SCRIPT_MENU;; 4) DRYRUN2 SCRIPT_MENU;; 5) DISTUPGRADE SCRIPT_MENU;; 6) PIPUPGRADE SCRIPT_MENU;; 7) REMOVEFLOPPY SCRIPT_MENU;; 8) MPVMFIX echo "" read -n 1 -s -p "Press any key to continue" SCRIPT_MENU;; 0) ENDISASU SCRIPT_MENU;; [Ii]) INSTALL_MENU;; [Ll]) ENABLE_REMOTESYSLOG;; [Cc]) CHANGECOPYCERTS_INSTALL SCRIPT_MENU;; [Dd]) DNSUPDATE SCRIPT_MENU;; [Vv]) ADDVEEAMUSER read -n 1 -s -p "Press any key to continue" SCRIPT_MENU;; [Pp]) PYTHON3UPGRADE SCRIPT_MENU;; [Rr]) GO_REBOOT SCRIPT_MENU;; [Ss]) SHUTDOWN SCRIPT_MENU;; [Uu]) COPYCERTS_UPDATE SCRIPT_MENU;; [Qq]) EXIT1 exit 0;; *) echo "Thats an invaild option,"; echo "please select a valid option only."; sleep 1;; esac done } INSTALL_MENU() { while : do clear echo "" echo -e " ${LGreen}LinUPx - L I N U X U P D A T E S C R I P T S${Color_Off} ${DGray}(ver-${VERS})${Color_Off}" echo -e " ${Green}INSTALLATION SCRIPTS${Color_Off}" echo -e "${LGreen}---------------------------------------------------------------------------${Color_Off}" echo -e "Hostname: ${BBlue}$(hostname -s)${Color_Off}" echo -e "Domain: ${BBlue}$(hostname -d)${Color_Off}" echo -e "${LGreen}---------------------------------------------------------------------------${Color_Off}" echo "" echo " [1] Webmin" echo " [2] Glances" echo " [3] x11vnc" echo " [4] Filewatcher" echo " [5] MySQL-BU" echo " [6] DSMon" echo " [7] iPerf v3.10.1" echo " [8] Speedtest.net" echo "" echo " [N] Install Netdata Agent" echo " [P] Install Postfix" echo " [U] Install UrBackup Client" echo "" echo " [9] Install .bashrc for root" echo " [0] Remove LinUPx" echo "" echo " [B] Back to Update Scripts" echo " [Q] Quit" echo "" echo "" echo -e -n "${BOrange}Please select an [ActionItem] from above:${Color_Off} " read -n 1 opt echo "" case $opt in 1) WEBMIN_INSTALL INSTALL_MENU;; 2) GLANCES_INSTALL INSTALL_MENU;; 3) X11VNC_INSTALL INSTALL_MENU;; 4) FW_INSTALL INSTALL_MENU;; 5) MYSQLBU_INSTALL INSTALL_MENU;; 6) DSMON_INSTALL INSTALL_MENU;; 7) IPERF_INSTALL INSTALL_MENU;; 8) SPEEDTEST_INSTALL INSTALL_MENU;; 9) BASHRC_INSTALL INSTALL_MENU;; 0) LINUPX_UNINSTALL INSTALL_MENU;; [Uu]) URBACKUP_INSTALL INSTALL_MENU;; [Pp]) POSTFIX_INSTALL INSTALL_MENU;; [Nn]) NETDATA_INSTALL INSTALL_MENU;; [Bb]) SCRIPT_MENU;; [Qq]) EXIT1 exit 1;; *) echo "Thats an invaild option,"; echo "please select a valid option only."; sleep 1;; esac done } if [ ${action-x} ]; then case $1 in ccupdate) COPYCERTS_UPDATE;; dnsupdate) DNSUPDATE;; update) UPDATE3;; up) UPDATE4;; mpvmfix) MPVMFIX;; addveeamuser) ADDVEEAMUSER;; netdataremove) NETDATA_UNINSTALL;; # *) echo "Thats an invaild option,"; # exit 1;; esac else SCRIPT_MENU fi exit 0