diff --git a/check_packages2install-pkgmanager/yum.sh b/check_packages2install-pkgmanager/yum.sh index 956db67c67ae923a59ba6d287f460324d4c33b03..83ca27be4506b14fdf88e48a424e2fdc5d4f92b0 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