Update linupx-scripts.sh

This commit is contained in:
2023-08-24 22:41:09 -05:00
parent 9abbc46fbc
commit f9fddd9a3c

View File

@@ -32,7 +32,7 @@ if [ ! -d "/opt/idssys/defaults" ]; then
git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
fi 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 source /opt/idssys/linupx/settings.conf
@@ -59,19 +59,19 @@ UPDATE1() {
sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db
fi fi
if type yum &>/dev/null; then if type yum &>/dev/null; then
$APTFUNC -y update ${APTFUNC} -y update
else else
[[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE
$APTFUNC update ${APTFUNC} update
$APTFUNC upgrade -y ${APTFUNC} upgrade -y
$APTFUNC dist-upgrade ${APTFUNC} dist-upgrade
# echo # echo
# read -n 1 -p "Would you like to run dist-upgrade as well (Y/n)?" choice # read -n 1 -p "Would you like to run dist-upgrade as well (Y/n)?" choice
# echo # echo
# case "$choice" in # case "$choice" in
# [Yy]) $APTFUNC dist-upgrade;; # [Yy]) ${APTFUNC} dist-upgrade;;
# esac # esac
[[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE
@@ -92,13 +92,13 @@ UPDATE2() {
[[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE
$APTFUNC upgrade -y ${APTFUNC} upgrade -y
echo echo
read -n 1 -p "Would you like to run dist-upgrade as well (Y/n)?" choice read -n 1 -p "Would you like to run dist-upgrade as well (Y/n)?" choice
echo echo
case "$choice" in case "$choice" in
[Yy]) $APTFUNC dist-upgrade;; [Yy]) ${APTFUNC} dist-upgrade;;
esac esac
[[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE [[ "$useAutoremove" -ne 0 ]] && AUTOREMOVE
@@ -137,10 +137,10 @@ UPDATE3() {
sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db sudo apt-mark unhold libopennms-java libopennmsdeps-java opennms-common opennms-db
fi fi
if [ "$useAutoremove" -ne 0 ]; then if [ "$useAutoremove" -ne 0 ]; then
apt-get -y autoremove &>> /opt/runupdates.log ${APTFUNC} -y autoremove &>> /opt/runupdates.log
apt-get update &>> /opt/runupdates.log ${APTFUNC} update &>> /opt/runupdates.log
apt-get upgrade -y &>> /opt/runupdates.log ${APTFUNC} upgrade -y &>> /opt/runupdates.log
apt-get -y autoremove &>> /opt/runupdates.log ${APTFUNC} -y autoremove &>> /opt/runupdates.log
fi fi
if [ "$opennms" = true ]; then if [ "$opennms" = true ]; then
sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db
@@ -170,10 +170,10 @@ UPDATE4() {
yum -y update yum -y update
else else
if [[ "$useAutoremove" -ne 0 ]]; then if [[ "$useAutoremove" -ne 0 ]]; then
apt-get -y autoremove ${APTFUNC} -y autoremove
apt-get update ${APTFUNC} update
apt-get upgrade -y ${APTFUNC} upgrade -y
apt-get -y autoremove ${APTFUNC} -y autoremove
fi fi
fi fi
touch "${FOLDER}/lastrun" touch "${FOLDER}/lastrun"
@@ -188,11 +188,11 @@ UPDATE4() {
} }
DISTUPGRADE() { DISTUPGRADE() {
if type yum &>/dev/null; then if type yum &>/dev/null; then
$APTFUNC upgrade ${APTFUNC} upgrade
else else
$APTFUNC dist-upgrade ${APTFUNC} dist-upgrade
fi fi
if [ "$useAutoremove" -ne 0 ] && type apt-get &>/dev/null; then if [ "$useAutoremove" -ne 0 ] && type ${APTFUNC} &>/dev/null; then
AUTOREMOVE AUTOREMOVE
fi fi
echo echo
@@ -203,7 +203,7 @@ DISTUPGRADE() {
PIPUPGRADE() { PIPUPGRADE() {
if ! command -v jq &> /dev/null if ! command -v jq &> /dev/null
then then
$APTFUNC install jq -y ${APTFUNC} install jq -y
fi fi
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
sudo python3 -m pip install --upgrade pip sudo python3 -m pip install --upgrade pip
@@ -226,21 +226,23 @@ DNSUPDATE() {
AUTOREMOVE() { AUTOREMOVE() {
if [[ "$useAutoremove" -ne 0 ]]; then if [[ "$useAutoremove" -ne 0 ]]; then
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
sudo apt-get autoremove sudo ${APTFUNC} autoremove
sudo ${APTFUNC} autoclean
else else
apt-get autoremove ${APTFUNC} autoremove
${APTFUNC} autoclean
fi fi
fi fi
} }
DRYRUN1() { DRYRUN1() {
if type apt &>/dev/null; then if type apt &>/dev/null; then
$APTFUNC update ${APTFUNC} update
$APTFUNC list --upgradable ${APTFUNC} list --upgradable
elif type apt-get &>/dev/null; then elif type ${APTFUNC} &>/dev/null; then
$APTFUNC update ${APTFUNC} update
$APTFUNC upgrade --dry-run ${APTFUNC} upgrade --dry-run
elif type yum &>/dev/null; then elif type yum &>/dev/null; then
$APTFUNC check-update ${APTFUNC} check-update
fi fi
echo echo
echo -e "${idsCL[Green]}Upgrade dry-run has completed${idsCL[Default]}" echo -e "${idsCL[Green]}Upgrade dry-run has completed${idsCL[Default]}"
@@ -249,9 +251,9 @@ DRYRUN1() {
} }
DRYRUN2() { DRYRUN2() {
if type yum &>/dev/null; then if type yum &>/dev/null; then
$APTFUNC --obsoletes check-update ${APTFUNC} --obsoletes check-update
else else
$APTFUNC dist-upgrade --dry-run ${APTFUNC} dist-upgrade --dry-run
fi fi
echo echo
echo -e "${idsCL[Green]}Dist-Upgrade dry-run has completed${idsCL[Default]}" echo -e "${idsCL[Green]}Dist-Upgrade dry-run has completed${idsCL[Default]}"
@@ -529,11 +531,11 @@ SPEEDTEST_INSTALL() {
* ) * )
echo 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 pip uninstall speedtest speedtest-cli -y >/dev/null 2&>1
rm /usr/local/bin/speedtest-cli >/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 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
echo -e "${idsCL[Green]}SpeedTest has been Installed${idsCL[Default]}" echo -e "${idsCL[Green]}SpeedTest has been Installed${idsCL[Default]}"
@@ -628,7 +630,7 @@ PYTHON3UPGRADE(){
[Nn]) INSTALL_MENU;; [Nn]) INSTALL_MENU;;
* ) * )
add-apt-repository -y ppa:deadsnakes/ppa 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.8 1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
update-alternatives --config python3 update-alternatives --config python3