diff --git a/check_packages2install-pkgmanager/yum.sh b/check_packages2install-pkgmanager/yum.sh index 4ce9e8d72e616e0437f2ed8e8145e5ced5d82a04..8121c60df07b72f00b72905d5d21c4fd3eb2a0f5 100644 --- a/check_packages2install-pkgmanager/yum.sh +++ b/check_packages2install-pkgmanager/yum.sh @@ -11,6 +11,7 @@ # 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 # =============================================================== @@ -38,8 +39,16 @@ function yum.getPackageList(){ # --------------------------------------------------------------- # get custom status function yum.getStatusLine(){ - if ! sudo /usr/bin/yum --bugfix check-update 2>&1 | grep security; then - echo "No security updates needed and no updates available" + typeset -i local _osversion + _osversion=$(grep -o "\ [0-9]*\." /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" + fi + else + if ! sudo /usr/bin/yum --bugfix check-update 2>&1 | grep security; then + echo "No security updates needed and no updates available" + fi fi }