From 7da13c97d2be3db2d67bc9148fa2f1bcc24e1ce5 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Fri, 25 Aug 2023 09:45:10 +0200 Subject: [PATCH] Yum: fix for #6610 --- check_packages2install-pkgmanager/yum.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/check_packages2install-pkgmanager/yum.sh b/check_packages2install-pkgmanager/yum.sh index 956db67..83ca27b 100644 --- a/check_packages2install-pkgmanager/yum.sh +++ b/check_packages2install-pkgmanager/yum.sh @@ -7,13 +7,14 @@ # included by ../check_packages2install # # --------------------------------------------------------------- -# ah <axel.hahn@iml.unibe.ch> +# ah <axel.hahn@unibe.ch> # 2022-06-03 v1.0 ah first version # 2022-06-07 v1.1 ah add sudo for yum --bugfix check-update # rename functions # 2022-08-31 v1.2 ah status line depends on os major version # 2023-07-17 v1.3 ah fix hiding obsolete packages -# 2023-08-24 v1.4 ah centos9: update getStatusLine() + +# 2023-08-24 v1.4 ah centos9: update getStatusLine() + getSecurityCount +# 2023-08-25 v1.5 ah centos9: fix package lists # =============================================================== @@ -37,6 +38,12 @@ function yum.getPackageList(){ test "$iEnd" = "-1" && sEnd='$' test $iEnd -gt $iStart && echo "$packagemanOut" | sed -n ${iStart},${sEnd}p + if [ $iEnd -gt $iStart ]; then + echo "$packagemanOut" | sed -n ${iStart},${sEnd}p + else + echo "$packagemanOut" | grep -v "^Last" | grep "[a-z]" + fi + } # --------------------------------------------------------------- @@ -60,7 +67,11 @@ function yum.getStatusLine(){ ;; 9) local _total; _total=$( echo "${packages2install}" | wc -l ) - local _sec; _sec=$( sudo /usr/bin/yum -y --security check-update | grep -v "^Last" | grep -c "." ) + local _sec; _sec=$( sudo /usr/bin/yum -y --security check-update \ + | grep -v "^Last" \ + | grep -v "^No security updates needed" \ + | grep -c "[a-z]" + ) # create a status line like in former yum versions if [ -z "$_sec" ]; then -- GitLab