From 43ebbd092a9a4999cc31327aa2c5d5ef621e3a2a Mon Sep 17 00:00:00 2001 From: Wim Godden Date: Sat, 7 Aug 2021 23:59:07 +0200 Subject: [PATCH] Added OS Security updates (for YUM only so far) Added OS Security updates (for YUM only so far) Added OS Security updates (for YUM only so far) Added OS Security updates (for YUM only so far) Added OS Security updates (for YUM only so far) Added OS Security updates (for YUM only so far) --- snmp/osupdate | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/snmp/osupdate b/snmp/osupdate index 11a6d9a9b..c6a973a01 100755 --- a/snmp/osupdate +++ b/snmp/osupdate @@ -18,6 +18,7 @@ BIN_ZYPPER='/usr/bin/env zypper' CMD_ZYPPER='-q lu' BIN_YUM='/usr/bin/env yum' CMD_YUM='-q check-update' +CMD_YUM_SEC='-q updateinfo list sec' BIN_DNF='/usr/bin/env dnf' CMD_DNF='-q check-update' BIN_APT='/usr/bin/env apt-get' @@ -37,63 +38,68 @@ if command -v zypper &>/dev/null ; then # shellcheck disable=SC2086 UPDATES=$($BIN_ZYPPER $CMD_ZYPPER | $BIN_WC $CMD_WC) if [ "$UPDATES" -ge 2 ]; then - echo $(($UPDATES-2)); + echo $(($UPDATES-2)),Null; else - echo "0"; + echo "0,Null"; fi elif command -v dnf &>/dev/null ; then # Fedora # shellcheck disable=SC2086 UPDATES=$($BIN_DNF $CMD_DNF | $BIN_WC $CMD_WC) if [ "$UPDATES" -ge 1 ]; then - echo $(($UPDATES-1)); + echo $(($UPDATES-1)),Null; else - echo "0"; + echo "0,Null"; fi elif command -v pacman &>/dev/null ; then # Arch UPDATES=$($BIN_PACMAN $CMD_PACMAN | $BIN_WC $CMD_WC) if [ "$UPDATES" -ge 1 ]; then - echo $(($UPDATES-1)); + echo $(($UPDATES-1)),Null; else - echo "0"; + echo "0,Null"; fi elif command -v yum &>/dev/null ; then # CentOS / Redhat # shellcheck disable=SC2086 UPDATES=$($BIN_YUM $CMD_YUM | $BIN_WC $CMD_WC) if [ "$UPDATES" -ge 1 ]; then - echo $(($UPDATES-1)); + UPDATES_SEC=$($BIN_YUM $CMD_YUM_SEC | $BIN_WC $CMD_WC) + if [ "$UPDATES_SEC" -ge 1 ]; then + echo $(($UPDATES)),$(($UPDATES_SEC)); + else + echo $(($UPDATES)),Null; + fi else - echo "0"; + echo "0,Null"; fi elif command -v apt-get &>/dev/null ; then # Debian / Devuan / Ubuntu # shellcheck disable=SC2086 UPDATES=$($BIN_APT $CMD_APT | $BIN_GREP $CMD_GREP 'Inst') if [ "$UPDATES" -ge 1 ]; then - echo "$UPDATES"; + echo $(($UPDATES)),Null; else - echo "0"; + echo "0,Null"; fi elif command -v pkg &>/dev/null ; then # FreeBSD # shellcheck disable=SC2086 UPDATES=$($BIN_PKG $CMD_PKG | $BIN_WC $CMD_WC) if [ "$UPDATES" -ge 1 ]; then - echo "$UPDATES"; + echo $(($UPDATES)),Null; else - echo "0"; + echo "0,Null"; fi elif command -v apk &>/dev/null ; then # Alpine # shellcheck disable=SC2086 UPDATES=$($BIN_APK $CMD_APK | $BIN_WC $CMD_WC) if [ "$UPDATES" -ge 2 ]; then - echo $(($UPDATES-1)); + echo $(($UPDATES-1)),Null; else - echo "0"; + echo "0,Null"; fi else - echo "0"; + echo "0,Null"; fi