#!/usr/bin/env bash # LinUPx - Linux Update Scripts [ "${2}" != "q" ] && source /opt/idssys/defaults/colors.inc source /opt/idssys/defaults/default.inc source /opt/idssys/linupx/settings.conf source /opt/idssys/linupx/defaults.inc [ -z ${useAutoremove+x} ] && echo -e "useAutoremove=1" >> /opt/idssys/linupx/settings.conf && source /opt/idssys/linupx/settings.conf [ "$(dpkg-query -W --showformat='${Status}\n' grepcidr 2>/dev/null | grep "install ok installed")" == "" ] && sudo ${APTFUNC} -y install grepcidr >/dev/null 2>&1 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 [ -f ${NM_FOLDER}/conf/defaults.local.inc ] && /usr/local/bin/nmg skip on ${APTFUNC} upgrade -y ${APTFUNC} dist-upgrade [[ "$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 "${idsCL[Green]}Updates have completed${idsCL[Default]}" [ ${action-x} ] && exit 0 if [ -f ${NM_FOLDER}/conf/defaults.local.inc ]; then echo read -n 1 -p "Would you like to disable NMG SKIP and reboot right away (Y/n)?" choice case "$choice" in [Nn]) tmp=temp;; * ) /usr/local/bin/nmg skip reboot;; esac else ENTER2CONTINUE fi } UPDATE2() { if [ "$opennms" = true ]; then sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db fi [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE [ -f ${NM_FOLDER}/conf/defaults.local.inc ] && /usr/local/bin/nmg skip on ${APTFUNC} upgrade -y ${APTFUNC} dist-upgrade [[ "$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 "${idsCL[Green]}Updates have completed${idsCL[Default]}" [ ${action-x} ] && exit 0 if [ -f ${NM_FOLDER}/conf/defaults.local.inc ]; then echo read -n 1 -p "Would you like to disable NMG SKIP and reboot right away (Y/n)?" choice case "$choice" in [Nn]) tmp=temp;; * ) /usr/local/bin/nmg skip reboot;; esac else ENTER2CONTINUE fi } 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 [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE >> /opt/runupdates.log ${APTFUNC} update >> /opt/runupdates.log [ -f ${NM_FOLDER}/conf/defaults.local.inc ] && /usr/local/bin/nmg skip on >> /opt/runupdates.log ${APTFUNC} upgrade -y >> /opt/runupdates.log [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE >> /opt/runupdates.log if [ "$opennms" = true ]; then sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db fi fi touch "${FOLDER}/lastrun" echo echo -e "${idsCL[Green]}Updates have completed${idsCL[Default]}" if [ "$autorun_restart_after" = true ] || [ "$restart_flag" = true ]; then echo -e "${BOrange}Rebooting now...${idsCL[Default]}" sleep 3 [ -f ${NM_FOLDER}/conf/defaults.local.inc ] && /usr/local/bin/nmg skip reboot >> /opt/runupdates.log 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 [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE ${APTFUNC} update ${APTFUNC} upgrade -y [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE fi touch "${FOLDER}/lastrun" echo echo -e "${idsCL[Green]}Updates have completed${idsCL[Default]}" if [ "$autorun_restart_after" = true ] || [ "$restart_flag" = true ]; then echo -e "${BOrange}Rebooting now...${idsCL[Default]}" 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 ${APTFUNC} &>/dev/null; then AUTOREMOVE fi echo echo -e "${idsCL[Green]}Dist Upgrades has completed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE } PIPUPGRADE() { if ! command -v jq &> /dev/null then ${APTFUNC} install jq -y fi [ "${1}" == "ii" ] && ii=' --ignore-installed' || ii='' pipupdates=$(pip3 list --outdated --format=json | jq -r '.[] | "\(.name)==\(.latest_version)"') python3 -m pip install --upgrade pip if [ "${pipupdates}" != "" ]; then echo ${pipupdates} | xargs -n1 pip3 install${ii} -U else echo -e "\n${idsCL[LightCyan]}There are no Python-Pip updates available to install${idsCL[Default]}" fi echo echo -e "${idsCL[Green]}Python-Pip Updates has completed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE } PIPUPGRADEFIX(){ ${APTFUNC} install libsystemd-dev libcairo2-dev pkg-config python3-dev libcurl4-openssl-dev libssl-dev build-essential libpython3-dev libdbus-glib-1-dev libgirepository1.0-dev pip install dbus-python pycairo echo [ ${action-x} ] && exit 0 ENTER2CONTINUE } DOCKER_UPDATE(){ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nickfedor/watchtower --run-once --cleanup echo echo -e "${idsCL[Green]}Docker Updates have completed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE } DNSUPDATE() { bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/update-dns.sh) ${1} echo [ ${action-x} ] && exit 0 ENTER2CONTINUE } AUTOREMOVE() { if [[ "$useAutoremove" -ne 0 ]]; then if [ "$EUID" -ne 0 ]; then sudo ${APTFUNC} autoremove sudo ${APTFUNC} autoclean else ${APTFUNC} autoremove ${APTFUNC} autoclean fi fi } DRYRUN1() { if type apt &>/dev/null; then ${APTFUNC} update ${APTFUNC} list --upgradable elif type ${APTFUNC} &>/dev/null; then ${APTFUNC} update ${APTFUNC} upgrade --dry-run elif type yum &>/dev/null; then ${APTFUNC} check-update fi echo echo -e "${idsCL[Green]}Upgrade dry-run has completed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE } DRYRUN2() { if type yum &>/dev/null; then ${APTFUNC} --obsoletes check-update else ${APTFUNC} dist-upgrade --dry-run fi echo echo -e "${idsCL[Green]}Dist-Upgrade dry-run has completed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE } GO_REBOOT() { [ "$EUID" -ne 0 ] && adm="SUDO " || adm="" if [ -f /opt/idssys/nodemgmt/.tmp/.skip ]; then echo -e "\n${idsCL[LightCyan]}NodeMgmt Skip is currently enabled: Should we disable that and reboot, or just reboot?${idsCL[Default]}" echo -en " ${idsCL[White]}(${idsCL[LightGreen]}Y${idsCL[White]})es ${idsCL[LightCyan]}/${idsCL[White]} (${idsCL[LightGreen]}R${idsCL[White]})eboot ${idsCL[LightCyan]}/${idsCL[White]} (${idsCL[LightGreen]}*${idsCL[White]})any other key to cancel${idsCL[Default]}" read -n 1 -p " : " choice case "$choice" in [Yy]) ${adm}/usr/local/bin/nmg skip reboot echo 'The system is now rebooting...' sleep 60 exit 0;; [Rr]) ${adm}shutdown -r now echo 'The system is now rebooting...' sleep 60 exit 0;; * ) MAIN_MENU;; esac else echo -e "\n${idsCL[LightCyan]}Are you sure you wish to reboot?${idsCL[Default]}" echo -en " ${idsCL[White]}(${idsCL[LightGreen]}Y${idsCL[White]})es ${idsCL[LightCyan]}/${idsCL[White]} (${idsCL[LightGreen]}*${idsCL[White]})any other key to cancel${idsCL[Default]}" read -n 1 -p " : " choice case "$choice" in [Yy]) ${adm}shutdown -r now echo -e "\n\nThe system is now rebooting..." sleep 60 exit 0;; * ) MAIN_MENU;; esac fi } SHUTDOWN() { if [ -f /opt/idssys/nodemgmt/.tmp/.skip ]; then echo -e "\n${idsCL[LightCyan]}NodeMgmt Skip is currently enabled: Should we disable that and shutdown, or just shutdown?${idsCL[Default]}" echo -en " ${idsCL[White]}(${idsCL[LightGreen]}Y${idsCL[White]})es ${idsCL[LightCyan]}/${idsCL[White]} (${idsCL[LightGreen]}S${idsCL[White]})hutdown ${idsCL[LightCyan]}/${idsCL[White]} (${idsCL[LightGreen]}*${idsCL[White]})any other key to cancel${idsCL[Default]}" read -n 1 -p " : " choice case "$choice" in [Yy]) ${adm}/usr/local/bin/nmg skip shutdown echo 'The system is now shutting down...' sleep 60 exit 0;; [Rr]) ${adm}poweroff echo 'The system is now shutting down...' sleep 60 exit 0;; * ) MAIN_MENU;; esac else echo -e "\n${idsCL[LightCyan]}Are you sure you wish to shutdown?${idsCL[Default]}" echo -en " ${idsCL[White]}(${idsCL[LightGreen]}Y${idsCL[White]})es ${idsCL[LightCyan]}/${idsCL[White]} (${idsCL[LightGreen]}*${idsCL[White]})any other key to cancel${idsCL[Default]}" read -n 1 -p " : " choice case "$choice" in [Yy]) ${adm}shutdown -h now echo -e "\n\nThe system is now shutting down..." sleep 60 exit 0;; * ) MAIN_MENU;; esac fi } 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 } RUN_STORAGE_TESTS(){ read -n 1 -p "Are you sure you wish to run Storage Speed Tests (Y/n)?" choice case "$choice" in [Nn]) MISC_MENU;; * ) echo bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/storage-test.sh) echo -e "${idsST[Reset]}${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE esac } 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 "${idsCL[Green]}Webmin has been Installed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}Glances has been Installed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}MySQL-BU has been Installed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}DSMon has been Installed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE esac } SYNCTHING_INSTALL() { read -n 1 -p "Are you sure you wish to install Syncthing (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo sudo mkdir -p /etc/apt/keyrings sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list ${APTFUNC} update ${APTFUNC} install -y syncthing echo -e "[Unit] Description=Syncthing - Open Source Continuous File Synchronization for %I Documentation=man:syncthing(1) After=network.target [Service] User=root ExecStart=/usr/bin/syncthing -no-browser -gui-address=\"0.0.0.0:8384\" -no-restart -logflags=0 Restart=on-failure SuccessExitStatus=3 4 RestartForceExitStatus=3 4 [Install] WantedBy=multi-user.target " > /etc/systemd/system/syncthing.service systemctl daemon-reload systemctl enable --now syncthing echo echo -e "${idsCL[Green]}Syncthing has been Installed, you can access at http://${RNIP}:8384${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE ;; 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 "${idsCL[Green]}Floppy has been removed, you must reboot to take effect.${idsCL[Default]}" 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...${idsCL[Default]}" if [ "$EUID" -ne 0 ]; then sudo shutdown -r now else shutdown -r now; fi sleep 60 exit 0;; * ) MAIN_MENU;; esac else echo -e "${idsCL[Green]}Floppy has already been removed.${idsCL[Default]}" echo [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}Netdata Agent has been Removed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE esac else read -n 1 -p "Are you sure you wish to install Netdata Agent (Y/n)?" choice case "$choice" in [Nn]) t=t;; * ) 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 "${idsCL[Green]}Netdata Agent has been Installed${idsCL[Default]}" esac fi [ ${action-x} ] && exit 0 ENTER2CONTINUE } 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 [ ${action-x} ] && exit 0 ENTER2CONTINUE } 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-${IPERFVER}.tar.gz tar -zxhf iperf-${IPERFVER}.tar.gz cd /tmp/iperf-${IPERFVER} ./configure make make install ldconfig cd /tmp rm -Rf iperf* echo echo -e "${idsCL[Green]}iPerf has been Installed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}copycerts.sh has been updated${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}SpeedTest has been Installed${idsCL[Default]}" echo echo -e "${LightCyan}To run, use the command: speedtest${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}UrBackup Client has been Installed${idsCL[Default]}" echo [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 "${idsCL[Green]}x11vnc has been Installed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE 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 } 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/master/install-dsmon.sh) echo ENTER2CONTINUE esac } DOCKER_INSTALL() { read -n 1 -p "Are you sure you wish to install Docker (Y/n)?" choice case "$choice" in [Nn]) INSTALL_MENU;; * ) echo apt remove -y docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc apt -y install ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg echo \ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null apt update sudo apt -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin echo ENTER2CONTINUE esac } DOCKER_CLEANUP(){ echo -en "\n${idsCL[LightCyan]}Cleaning up leftover Docker container files ... " docker system prune -a #-f -q >/dev/null 2>&1 docker image prune -a #-f -q >/dev/null 2>&1 docker volume prune #-q >/dev/null 2>&1 docker rm -v $(sudo docker ps -a -q -f status=exited -q) >/dev/null 2>&1 docker rmi -f $(sudo docker images -f "dangling=true" -q) >/dev/null 2>&1 docker volume ls -qf dangling=true | xargs -r docker volume rm >/dev/null 2>&1 docker network prune echo -e "${idsCL[Green]}Done${idsCL[Default]}" } INSTALL_WATCHTOWER() { echo if [ ${1} -eq 1 > /dev/null 2>&1 ]; then docker run --rm \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ -e TZ=America/Chicago \ -e WATCHTOWER_CLEANUP=true \ -e WATCHTOWER_INCLUDE_STOPPED=true \ -e WATCHTOWER_ROLLING_RESTART=false \ -e WATCHTOWER_NO_STARTUP_MESSAGE=true \ -e WATCHTOWER_NOTIFICATIONS=email \ -e WATCHTOWER_NOTIFICATIONS_LEVEL=warn \ -e WATCHTOWER_NOTIFICATION_EMAIL_FROM=watchtower-$(hostname)@scity.us \ -e WATCHTOWER_NOTIFICATION_EMAIL_TO=b3upzaom7a@pomail.net \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=mail.scity.us \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=25 \ nickfedor/watchtower --run-once else if [ "$(docker ps -a -q -f name=watchtower)" ]; then echo -en "${idsCL[LightYellow]}Removing previous Watchtower container... ${idsCL[Default]}" docker stop watchtower >/dev/null 2>&1 docker rm watchtower >/dev/null 2>&1 echo -e "${idsCL[Green]}Done${idsCL[Default]}\n" fi echo -e "${idsCL[LightCyan]}Installing Watchtower container... ${idsCL[Default]}" docker run --detach \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ -e TZ=America/Chicago \ -e WATCHTOWER_CLEANUP=true \ -e WATCHTOWER_INCLUDE_STOPPED=true \ -e WATCHTOWER_SCHEDULE="0 0 4 * * *" \ -e WATCHTOWER_ROLLING_RESTART=false \ -e WATCHTOWER_NO_STARTUP_MESSAGE=true \ -e WATCHTOWER_NOTIFICATIONS=email \ -e WATCHTOWER_NOTIFICATIONS_LEVEL=warn \ -e WATCHTOWER_NOTIFICATION_EMAIL_FROM=watchtower-$(hostname)@scity.us \ -e WATCHTOWER_NOTIFICATION_EMAIL_TO=b3upzaom7a@pomail.net \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=mail.scity.us \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=25 \ nickfedor/watchtower echo -e "\n${idsCL[Green]}Watchtower has been installed${idsCL[Default]}\n" until [ "$(docker inspect -f {{.State.Health.Status}} watchtower)"=="healthy" ]; do sleep 0.1; done; sleep 1s docker logs watchtower fi echo } PORTAINER_AGENT_INSTALL(){ if [ "$(docker ps -a -q -f name=portainer_agent)" ]; then echo -en "${idsCL[LightYellow]}Removing previous Portainer Agent container... ${idsCL[Default]}" docker stop portainer_agent >/dev/null 2>&1 docker rm portainer_agent >/dev/null 2>&1 echo -e "${idsCL[Green]}Done${idsCL[Default]}\n" fi echo -e "${idsCL[LightCyan]}Installing Portainer Agent container... ${idsCL[Default]}" docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes -v /:/host portainer/agent:latest >/dev/null 2>&1 echo -e "\n${idsCL[Green]}Portainer Agent has been installed${idsCL[Default]}\n" docker logs portainer_agent } TAILSCALE_INSTALL() { echo echo "This script currently only works with Ubuntu" read -n 1 -p "Are you sure you wish to install Tailscale (Y/n)?" choice case "$choice" in [Nn]) t=t;; * ) echo curl -fsSL https://tailscale.com/install.sh | sh echo read -n 1 -p "Tailscale is now installed, would you like to connect to https://headscale.scity.us? (Y/n): " choice case "$choice" in [Nn]) read -n 1 -p "Would you like connect to Tailscale directly instead? (Y/n): " choice case "$choice" in [Nn]) temp='';; * ) tailscale up --accept-dns=false --accept-routes=false ;; esac ;; * ) tailscale up --login-server=https://headscale.scity.us --accept-dns=false --accept-routes=false ;; esac echo ENTER2CONTINUE ;; 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]) t=t;; * ) echo echo -e "\n\n*.* @${RemoteSyslogServer}:514" >> /etc/rsyslog.d/50-default.conf service rsyslog restart ;; esac } PYTHON3UPGRADE(){ read -n 1 -p "Are you sure you wish to upgrade to Python3 (Y/n)?" choice case "$choice" in [Nn]) t=t;; * ) 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 "${idsCL[Green]}Python3.10 Upgrade has been Completed${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE esac } POSTFIX_INSTALL(){ bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-postfix.sh) echo [ ${action-x} ] && exit 0 ENTER2CONTINUE } POSTFIX_CLEARQUEUE(){ systemctl stop postfix postsuper -d ALL rm -f /var/log/mail* systemctl start postfix echo 'd *' | mail -N } BASHRC_INSTALL(){ echo -e "${idsCL[Green]}Installing root/.bashrc${idsCL[Default]}" /usr/bin/wget -O ~/.bashrc https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/bashrc [ ${action-x} ] && exit 0 ENTER2CONTINUE } MPVMFIX(){ echo -e " blacklist { device { vendor \"VMware\" product \"Virtual disk\" } } " >> /etc/multipath.conf /etc/init.d/multipath-tools restart } GET_WANIP(){ wanip=$(curl -sL https://go.scity.us/get-wanip | bash) echo -e "\n${idsCL[Green]}Your WAN IP: ${idsST[Bold]}${wanip}${idsST[Reset]}${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE } 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 /bin/sed -i 's/opt\/lb-data\/letsencrypt/etc\/letsencrypt/g' /opt/copycerts.sh crontab -l | grep '/opt/copycerts.sh' | grep -q -v '#' && /opt/copycerts.sh echo echo -e "${idsCL[Green]}copycerts.sh has been updated${idsCL[Default]}" else echo -e "${Blue}copycerts.sh not found${idsCL[Default]}" fi [ ${action-x} ] && exit 0 ENTER2CONTINUE } UPDATEREPOKEYS(){ apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com echo echo -e "${idsCL[Green]}APT Repo Keys have been updated${idsCL[Default]}" [ ${action-x} ] && exit 0 ENTER2CONTINUE } RECONFIGURE_NETWORK(){ if [ -f /etc/netplan/99-netcfg-* ]; then echo -en "${idsCL[LightYellow]}New VM Detected, fixing netplan: " rm -f /etc/netplan/*.yaml >/dev/null 2>&1 [ -f /etc/netplan/eth0* ] && mv /etc/netplan/eth0* /etc/netplan/eth0.yaml >/dev/null 2>&1 if [ ! -f /etc/netplan/eth0.yaml ]; then echo -e "network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no addresses: [10.10.4.20/16] gateway4: 10.10.0.1 nameservers: addresses: [10.10.10.10,10.10.10.11] " > /etc/netplan/eth0.yaml >/dev/null 2>&1 fi netplan apply >/dev/null 2>&1 echo -e "${idsCL[Green]}Done${idsCL[Default]}\n\n" elif [ -d /etc/sysconfig/network-scripts ]; then if [ ! -f /etc/sysconfig/network-scripts/ifcfg-eth0 ] || grep /etc/sysconfig/network-scripts/ifcfg-eth0 -e "Generated by VMWare" >/dev/null; then rm -f /etc/sysconfig/network-scripts/ifcfg-eth0 >/dev/null 2>&1 echo -e "TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no NAME=\"eth0\" UUID=43def898-c3e6-402b-ad94-e8047a2c2a63 DEVICE=\"eth0\" ONBOOT=yes IPADDR=10.10.4.20 PREFIX=16 GATEWAY=10.10.0.1 DNS1=10.10.10.10 DNS2=10.10.10.11 IPV6_DISABLED=yes " > /etc/sysconfig/network-scripts/ifcfg-eth0 /usr/bin/nmcli connection up eth0 >/dev/null 2>&1 fi fi echo -en "\n${idsCL[LightCyan]}Would you like to configure the hostname and network settings (y/N)? ${idsCL[Default]}" read choice case "$choice" in [Yy]) echo echo -en "${idsCL[LightYellow]}Hostname [Current='${idsCL[White]}$(hostname)${idsCL[LightYellow]}']: ${idsCL[Default]}" read -e HOSTNAME [ "${HOSTNAME}" == "" ] && HOSTNAME=$(hostname) echo echo -en "${idsCL[LightYellow]}Domain (optional): ${idsCL[Default]}" read -e DOMAIN echo REPIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) echo -en "${idsCL[LightYellow]}IP Address [Current='${idsCL[White]}${REPIP}${idsCL[LightYellow]}']: ${idsCL[Default]}" read -e IPADDRESS [ "${IPADDRESS}" == "" ] && IPADDRESS=${REPIP} echo REPSUB=`/sbin/ifconfig eth0 | awk '/netmask/{ print $4;} '` echo -en "${idsCL[LightYellow]}Subnet Mask [Current='${idsCL[White]}${REPSUB}${idsCL[LightYellow]}']: ${idsCL[Default]}" read -e SUBNET [ "${SUBNET}" == "" ] && SUBNET=${REPSUB} echo REPGW=`route -n | grep 'UG[ \t]' | awk '{print $2}'` echo -en "${idsCL[LightYellow]}Gateway IP [Current='${idsCL[White]}${REPGW}${idsCL[LightYellow]}']: ${idsCL[Default]}" read -e GATEWAY [ "${GATEWAY}" == "" ] && GATEWAY=${REPGW} echo REPPRIDNS=`resolvectl -i eth0 dns | awk '/eth0/{ print $4;} '` echo -en "${idsCL[LightYellow]}Primary DNS [Current='${idsCL[White]}${REPPRIDNS}${idsCL[LightYellow]}']: ${idsCL[Default]}" read -e PRIDNS [ "${PRIDNS}" == "" ] && PRIDNS=${REPPRIDNS} echo REPSECDNS=`resolvectl -i eth0 dns | awk '/eth0/{ print $5;} '` echo -en "${idsCL[LightYellow]}Secondary DNS (optional) [Current='${idsCL[White]}${REPSECDNS}${idsCL[LightYellow]}']: ${idsCL[Default]}" read -e SECDNS [ "${SECDNS}" == "" ] && SECDNS=${REPSECDNS} echo echo echo "Confirm settings:" echo -e "${idsCL[LightCyan]}Hostname : ${idsCL[Green]}${HOSTNAME}${idsCL[Default]}" if [ "${DOMAIN}" != "" ]; then echo -e "${idsCL[LightCyan]}Domain : ${idsCL[Green]}${DOMAIN}${idsCL[Default]}" echo -e "${idsCL[LightCyan]}FQDN : ${idsCL[Green]}${HOSTNAME}.${DOMAIN}${idsCL[Default]}" fi echo -e "${idsCL[LightCyan]}IP Address : ${idsCL[Green]}${IPADDRESS}${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Subnet Mask : ${idsCL[Green]}${SUBNET}${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Gateway IP : ${idsCL[Green]}${GATEWAY}${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Primary DNS : ${idsCL[Green]}${PRIDNS}${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Secondary DNS : ${idsCL[Green]}${SECDNS}${idsCL[Default]}" echo echo -en "${idsCL[LightCyan]}Is this correct (Y/n)? ${idsCL[Default]}" read -n 1 choice case "$choice" in [Nn]) ;; *) echo -en "${idsCL[LightCyan]}Making configuration changes ... ${idsCL[Default]}" hostnamectl set-hostname ${HOSTNAME} >/dev/null 2>&1 sed -i '/127.0.1.1/d' /etc/hosts >/dev/null 2>&1 sed -i '/::1/d' /etc/hosts >/dev/null 2>&1 NEWSUB=`IPprefix_by_netmask ${SUBNET}` REPSUB=`IPprefix_by_netmask ${REPSUB}` [ "${DOMAIN}" == "" ] && echo "127.0.1.1 ${HOSTNAME}" >> /etc/hosts || echo "127.0.1.1 ${HOSTNAME}.${DOMAIN} ${HOSTNAME}" >> /etc/hosts if [ -f /etc/netplan/eth0.yaml ]; then sed -i "s/${REPIP}\/${REPSUB}/${IPADDRESS}\/${NEWSUB}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1 sed -i "s/${REPIP}\/${REPSUB}/${IPADDRESS}\/${NEWSUB}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1 [ "${SECDNS}" != "" ] && DNS="${PRIDNS},${SECDNS}" || DNS="${PRIDNS}" [ "${REPSECDNS}" != "" ] && REPDNS="${REPPRIDNS},${REPSECDNS}" || REPDNS="${REPPRIDNS}" sed -i "s/${REPDNS}/${DNS}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1 sed -i "s/${REPGW}/${GATEWAY}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1 sed -i '/search/d' /etc/netplan/eth0.yaml >/dev/null 2>&1 [ "${DOMAIN}" != "" ] && echo " search: [${DOMAIN}]" >> /etc/netplan/eth0.yaml netplan apply elif [ -f /etc/sysconfig/network-scripts/ifcfg-eth0 ]; then /usr/bin/nmcli connection modify eth0 ipv4.addresses ${IPADDRESS}/${NEWSUB} /usr/bin/nmcli connection modify eth0 ipv4.dns "${PRIDNS}" [ "${SECDNS}" != "" ] && /usr/bin/nmcli connection modify eth0 +ipv4.dns "${SECDNS}" /usr/bin/nmcli connection modify eth0 ipv4.gateway ${GATEWAY} [ "${DOMAIN}" != "" ] && /usr/bin/nmcli connection modify eth0 ipv4.dns-search ${DOMAIN} /usr/bin/nmcli connection modify eth0 ipv4.method manual /usr/bin/nmcli connection modify eth0 ipv6.method disabled /usr/bin/nmcli connection up eth0 >/dev/null 2>&1 fi echo -e "${idsCL[Green]}Done${idsCL[Default]}" echo ;; esac echo -e "\n${idsCL[Green]}Network has been updated${idsCL[Default]}\n" [ ${action-x} ] && exit 0 ENTER2CONTINUE ;; esac } MAIN_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 " ${idsCL[Green]}LinUPx - L I N U X U P D A T E S C R I P T S${idsCL[Default]} ${idsCL[White]}(ver-${VERS})${idsCL[Default]}" echo -e "${idsCL[Green]}---------------------------------------------------------------------------${idsCL[Default]}" echo -e "Hostname: ${idsCL[Cyan]}$(hostname -s)${idsCL[Default]}" echo -e "Domain: ${idsCL[Cyan]}$(hostname -d)${idsCL[Default]}" echo echo -e "Updates last run on: ${idsCL[LightGreen]}${LASTRUND} ${LASTRUNT}${idsCL[Default]}" echo -e "---------------------------------------------------------------------------" 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 "${idsCL[LightGreen]}---------------------------------------------------------------------------${idsCL[Default]}" echo echo -e " [${idsCL[Yellow]}1${idsCL[Default]}] Check for Updates/Upgrades" echo -e "*[${idsCL[Yellow]}2${idsCL[Default]}] Run Updates" if [ "$ATYPE" != 'yum' ]; then echo -e " [${idsCL[Yellow]}3${idsCL[Default]}] Run Updates w/o updating repos" fi echo -e "*[${idsCL[Yellow]}D${idsCL[Default]}] Update all Dockers" echo if [ "$ATYPE" != 'yum' ]; then echo -e " [${idsCL[Yellow]}4${idsCL[Default]}] Check for Upgrades with obsoletes enabled" echo -e " [${idsCL[Yellow]}5${idsCL[Default]}] Run Dist-Upgrade" echo fi echo -e "*[${idsCL[Yellow]}6${idsCL[Default]}] Run Python-Pip Upgrades" echo -e " [${idsCL[Yellow]}7${idsCL[Default]}] Run Python-Pip Upgrades (w/ --ignore-installed)" echo -e " [${idsCL[Yellow]}8${idsCL[Default]}] Install pkgs to fix Pip upgrades" echo if [ "$ATYPE" != 'yum' ]; then echo -e " [${idsCL[Yellow]}9${idsCL[Default]}] Update/Fix Missing APT Repo Keys" echo -e " [${idsCL[Yellow]}0${idsCL[Default]}] Enable/Disable Automatic Security Updates" echo fi echo -e " [${idsCL[Yellow]}I${idsCL[Default]}] Installation Scripts" echo -e " [${idsCL[Yellow]}M${idsCL[Default]}] Misc/Other Scripts" echo # echo -e " [${idsCL[Yellow]}L${idsCL[Default]}] Enable Remote Syslog" # echo -e " [Config file: RemoteSyslogServer=${RemoteSyslogServer}]" # echo echo -e " [${idsCL[Yellow]}R${idsCL[Default]}] Reboot System" echo -e " [${idsCL[Yellow]}S${idsCL[Default]}] Shutdown System" echo -e " [${idsCL[Yellow]}Q${idsCL[Default]}] Quit" echo echo echo -e -n "${idsCL[Yellow]}Please select an [ActionItem] from above:${idsCL[Default]} " read -n 1 opt echo case $opt in 1) DRYRUN1; MAIN_MENU;; 2) UPDATE1; MAIN_MENU;; 3) UPDATE2; MAIN_MENU;; [Dd]) DOCKER_UPDATE; MAIN_MENU;; 4) DRYRUN2; MAIN_MENU;; 5) DISTUPGRADE; MAIN_MENU;; 6) PIPUPGRADE; MAIN_MENU;; 7) PIPUPGRADE ii; MAIN_MENU;; 8) PIPUPGRADEFIX; MAIN_MENU;; 9) UPDATEREPOKEYS; MAIN_MENU;; 0) ENDISASU; MAIN_MENU;; [Ii]) INSTALL_MENU;; [Mm]) MISC_MENU;; [Rr]) GO_REBOOT; MAIN_MENU;; [Ss]) SHUTDOWN; MAIN_MENU;; [Qq]) EXIT1 exit 0;; *) echo "Thats an invaild option,"; echo "please select a valid option only."; sleep 1;; esac done } MISC_MENU() { while : do clear echo echo -e " ${idsCL[Green]}LinUPx - L I N U X U P D A T E S C R I P T S${idsCL[Default]} ${idsCL[White]}(ver-${VERS})${idsCL[Default]}" echo -e "${idsCL[Green]}---------------------------------------------------------------------------${idsCL[Default]}" echo -e "Hostname: ${idsCL[Cyan]}$(hostname -s)${idsCL[Default]}" echo -e "Domain: ${idsCL[Cyan]}$(hostname -d)${idsCL[Default]}" echo -e "${idsCL[LightGreen]}---------------------------------------------------------------------------${idsCL[Default]}" echo -e "\n ${idsCL[LightGreen]}MISC/OTHER SCRIPTS${idsCL[Default]}\n" echo -e " [${idsCL[Yellow]}1${idsCL[Default]}] Reconfigure Network" echo -e " [${idsCL[Yellow]}2${idsCL[Default]}] Remove Floppy from VM" echo -e " [${idsCL[Yellow]}3${idsCL[Default]}] Fix multipath/vmware issue" echo echo -e " [${idsCL[Yellow]}4${idsCL[Default]}] Cleanup leftover Docker container files" echo -e " [${idsCL[Yellow]}5${idsCL[Default]}] Install Docker Watchtower" echo echo -e " [${idsCL[Yellow]}6${idsCL[Default]}] Run Storage Speed Tests" echo if [ "$(IP_ALLOWED ${RNIP})" == "true" ]; then echo -e " [${idsCL[Yellow]}U${idsCL[Default]}] Update copycerts.sh to new LB LE folder path " echo -e " [${idsCL[Yellow]}D${idsCL[Default]}] Update DNS (10.10.10.10, 10.10.10.11)" echo -e " [${idsCL[Yellow]}O${idsCL[Default]}] Update Offsite DNS (10.2.1.6, 10.2.1.5)" echo -e " [${idsCL[Yellow]}C${idsCL[Default]}] Change copycerts to LB-Nodes" echo fi echo -e " [${idsCL[Yellow]}V${idsCL[Default]}] Add Veeam User Account" echo echo -e " [${idsCL[Yellow]}W${idsCL[Default]}] Get current WAN IP" echo -e "\n" echo -e " [${idsCL[Yellow]}B${idsCL[Default]}] Back to Main Menu" echo -e " [${idsCL[Yellow]}I${idsCL[Default]}] Installation Scripts" echo -e " [${idsCL[Yellow]}Q${idsCL[Default]}] Quit" echo echo echo -e -n "${idsCL[Yellow]}Please select a [#] from above:${idsCL[Default]} " read -n 1 opt echo case $opt in 1) RECONFIGURE_NETWORK; MISC_MENU;; 2) REMOVEFLOPPY; MISC_MENU;; 3) MPVMFIX echo ENTER2CONTINUE MISC_MENU;; 4) DOCKER_CLEANUP; ENTER2CONTINUE; MISC_MENU;; 5) echo echo -en "${idsCL[LightCyan]}Are you sure you wish to install Watchtower (Y/n)? ${idsCL[Default]}" read -n 1 choice case "$choice" in [Nn]) t=t;; * ) INSTALL_WATCHTOWER ENTER2CONTINUE ;; esac MISC_MENU ;; 6) RUN_STORAGE_TESTS; MISC_MENU;; [Uu]) COPYCERTS_UPDATE menu; MISC_MENU;; [Dd]) DNSUPDATE; MISC_MENU;; [Oo]) DNSUPDATE offsite; MISC_MENU;; [Cc]) CHANGECOPYCERTS_INSTALL; MISC_MENU;; [Ww]) GET_WANIP; MISC_MENU;; [Vv]) ADDVEEAMUSER ENTER2CONTINUE MISC_MENU;; [Bb]) MAIN_MENU;; [Ii]) INSTALL_MENU;; [Qq]) EXIT1; exit 1;; *) echo "Thats an invaild option,"; echo "please select a valid option only."; sleep 1;; esac done } INSTALL_MENU() { while : do clear echo echo -e " ${idsCL[Green]}LinUPx - L I N U X U P D A T E S C R I P T S${idsCL[Default]} ${idsCL[White]}(ver-${VERS})${idsCL[Default]}" echo -e "${idsCL[Green]}---------------------------------------------------------------------------${idsCL[Default]}" echo -e "Hostname: ${idsCL[Cyan]}$(hostname -s)${idsCL[Default]}" echo -e "Domain: ${idsCL[Cyan]}$(hostname -d)${idsCL[Default]}" echo -e "${idsCL[LightGreen]}---------------------------------------------------------------------------${idsCL[Default]}" echo -e "\n ${idsCL[LightGreen]}INSTALLATION SCRIPTS${idsCL[Default]}\n" echo -e " [${idsCL[Yellow]}0${idsCL[Default]}] Install Docker" echo -e " [${idsCL[Yellow]}1${idsCL[Default]}] Install Webmin" echo -e " [${idsCL[Yellow]}2${idsCL[Default]}] Install Glances" echo -e " [${idsCL[Yellow]}3${idsCL[Default]}] Install x11vnc" echo -e " [${idsCL[Yellow]}4${idsCL[Default]}] Install Filewatcher" echo -e " [${idsCL[Yellow]}5${idsCL[Default]}] Install MySQL-BU" echo -e " [${idsCL[Yellow]}7${idsCL[Default]}] Install iPerf v${IPERFVER} (LAN Speedtest)" echo -e " [${idsCL[Yellow]}8${idsCL[Default]}] Install Speedtest.net (WAN Speedtest)" echo echo -e " [${idsCL[Yellow]}D${idsCL[Default]}] Install DSMon" echo -e " [${idsCL[Yellow]}P${idsCL[Default]}] Install Postfix" echo -e " [${idsCL[Yellow]}U${idsCL[Default]}] Install UrBackup Client" echo -e " [${idsCL[Yellow]}S${idsCL[Default]}] Install Syncthing" echo -e " [${idsCL[Yellow]}T${idsCL[Default]}] Install Tailscale" echo echo -e " [${idsCL[Yellow]}9${idsCL[Default]}] Install .bashrc for root" # echo -e " [${idsCL[Yellow]}0] Remove LinUPx" echo echo -e " [${idsCL[Yellow]}B${idsCL[Default]}] Back to Main Menu" echo -e " [${idsCL[Yellow]}M${idsCL[Default]}] Misc/Other Scripts" echo -e " [${idsCL[Yellow]}Q${idsCL[Default]}] Quit" echo echo echo -e -n "${idsCL[Yellow]}Please select a [#] from above:${idsCL[Default]} " 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;; 7) IPERF_INSTALL; INSTALL_MENU;; 8) SPEEDTEST_INSTALL; INSTALL_MENU;; 9) BASHRC_INSTALL; INSTALL_MENU;; 0) DOCKER_INSTALL; INSTALL_MENU;; [Uu]) URBACKUP_INSTALL; INSTALL_MENU;; [Dd]) DSMON_INSTALL; INSTALL_MENU;; [Pp]) POSTFIX_INSTALL; INSTALL_MENU;; [Nn]) NETDATA_INSTALL; INSTALL_MENU;; [Ss]) SYNCTHING_INSTALL; INSTALL_MENU;; [Tt]) TAILSCALE_INSTALL; INSTALL_MENU;; [Bb]) MAIN_MENU;; [Mm]) MISC_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;; watchtower) INSTALL_WATCHTOWER ${2};; portaineragent) PORTAINER_AGENT_INSTALL;; docker-cleanup) DOCKER_CLEANUP;; syncthing-update) SYNCTHING_APT_UPDATE;; mailclear) POSTFIX_CLEARQUEUE;; temp) docker stop $(docker ps -a | grep 'watchtower' | awk '{print $1}') docker rm $(docker ps -a | grep 'watchtower' | awk '{print $1}') ;; # *) echo "Thats an invaild option,"; # exit 1;; esac else MAIN_MENU fi exit 0