From a07c7b922906d56c92063fd7131b0fa794767fec Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Wed, 31 Aug 2022 10:11:28 +0200 Subject: [PATCH] fix getStatusLine --- check_packages2install-pkgmanager/yum.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/check_packages2install-pkgmanager/yum.sh b/check_packages2install-pkgmanager/yum.sh index 8121c60..c308b76 100644 --- a/check_packages2install-pkgmanager/yum.sh +++ b/check_packages2install-pkgmanager/yum.sh @@ -40,14 +40,14 @@ function yum.getPackageList(){ # get custom status function yum.getStatusLine(){ typeset -i local _osversion - _osversion=$(grep -o "\ [0-9]*\." /etc/redhat-release | cut -f 1 -d '.') + _osversion=$(awk '{ print $4 }' /etc/redhat-release | cut -f 1 -d '.') if [ $_osversion -ge 8 ]; then - if ! sudo /usr/bin/yum --security check-update | grep "available"; then - echo "No security updates needed and no updates available" + if ! sudo /usr/bin/yum --security check-update 2>&1 | grep "available" ; then + echo "rc = $? [Not detected on v$_osversion]" fi else if ! sudo /usr/bin/yum --bugfix check-update 2>&1 | grep security; then - echo "No security updates needed and no updates available" + echo "rc = $? [Not detected on v$_osversion]" fi fi } -- GitLab