diff --git a/linupx-scripts.sh b/linupx-scripts.sh index 25f3917..5188e2b 100755 --- a/linupx-scripts.sh +++ b/linupx-scripts.sh @@ -32,7 +32,7 @@ if [ ! -d "/opt/idssys/defaults" ]; then 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 $APTFUNC -y install grepcidr >/dev/null 2>&1 +[ "$(dpkg-query -W --showformat='${Status}\n' grepcidr | grep "install ok installed")" == "" ] && sudo ${APTFUNC} -y install grepcidr >/dev/null 2>&1 source /opt/idssys/linupx/settings.conf @@ -59,19 +59,19 @@ UPDATE1() { sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db fi if type yum &>/dev/null; then - $APTFUNC -y update + ${APTFUNC} -y update else [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE - $APTFUNC update - $APTFUNC upgrade -y + ${APTFUNC} update + ${APTFUNC} upgrade -y - $APTFUNC dist-upgrade + ${APTFUNC} dist-upgrade # 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;; + # [Yy]) ${APTFUNC} dist-upgrade;; # esac [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE @@ -92,13 +92,13 @@ UPDATE2() { [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE - $APTFUNC upgrade -y + ${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;; + [Yy]) ${APTFUNC} dist-upgrade;; esac [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE @@ -137,10 +137,10 @@ UPDATE3() { 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 + ${APTFUNC} -y autoremove &>> /opt/runupdates.log + ${APTFUNC} update &>> /opt/runupdates.log + ${APTFUNC} upgrade -y &>> /opt/runupdates.log + ${APTFUNC} -y autoremove &>> /opt/runupdates.log fi if [ "$opennms" = true ]; then sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db @@ -170,10 +170,10 @@ UPDATE4() { yum -y update else if [[ "$useAutoremove" -ne 0 ]]; then - apt-get -y autoremove - apt-get update - apt-get upgrade -y - apt-get -y autoremove + ${APTFUNC} -y autoremove + ${APTFUNC} update + ${APTFUNC} upgrade -y + ${APTFUNC} -y autoremove fi fi touch "${FOLDER}/lastrun" @@ -188,11 +188,11 @@ UPDATE4() { } DISTUPGRADE() { if type yum &>/dev/null; then - $APTFUNC upgrade + ${APTFUNC} upgrade else - $APTFUNC dist-upgrade + ${APTFUNC} dist-upgrade fi - if [ "$useAutoremove" -ne 0 ] && type apt-get &>/dev/null; then + if [ "$useAutoremove" -ne 0 ] && type ${APTFUNC} &>/dev/null; then AUTOREMOVE fi echo @@ -203,7 +203,7 @@ DISTUPGRADE() { PIPUPGRADE() { if ! command -v jq &> /dev/null then - $APTFUNC install jq -y + ${APTFUNC} install jq -y fi if [ "$EUID" -ne 0 ]; then sudo python3 -m pip install --upgrade pip @@ -226,21 +226,23 @@ DNSUPDATE() { AUTOREMOVE() { if [[ "$useAutoremove" -ne 0 ]]; then if [ "$EUID" -ne 0 ]; then - sudo apt-get autoremove + sudo ${APTFUNC} autoremove + sudo ${APTFUNC} autoclean else - apt-get autoremove + ${APTFUNC} autoremove + ${APTFUNC} autoclean 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 + ${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 + ${APTFUNC} check-update fi echo echo -e "${idsCL[Green]}Upgrade dry-run has completed${idsCL[Default]}" @@ -249,9 +251,9 @@ DRYRUN1() { } DRYRUN2() { if type yum &>/dev/null; then - $APTFUNC --obsoletes check-update + ${APTFUNC} --obsoletes check-update else - $APTFUNC dist-upgrade --dry-run + ${APTFUNC} dist-upgrade --dry-run fi echo echo -e "${idsCL[Green]}Dist-Upgrade dry-run has completed${idsCL[Default]}" @@ -529,11 +531,11 @@ SPEEDTEST_INSTALL() { * ) echo - $APTFUNC remove -y -qq speedtest speedtest-cli >/dev/null 2&>1 + ${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 + ${APTFUNC} install -y speedtest echo echo -e "${idsCL[Green]}SpeedTest has been Installed${idsCL[Default]}" @@ -628,7 +630,7 @@ PYTHON3UPGRADE(){ [Nn]) INSTALL_MENU;; * ) add-apt-repository -y ppa:deadsnakes/ppa - $APTFUNC install -y python3.10 python3-pip + ${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