From dc594b9c98561447fc8f9ffaf69b11d4d1c27b94 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 22 Mar 2022 14:51:31 +0100 Subject: [PATCH] update yum command --- check_packages2install | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/check_packages2install b/check_packages2install index 9d6e248..584b6c3 100755 --- a/check_packages2install +++ b/check_packages2install @@ -156,16 +156,23 @@ function checkYum(){ # summary=`ph.execIfReady "/usr/bin/yum --security check-update 2>&1 | fgrep 'security'" ` # summary=`ph.execIfReady "/usr/bin/yum --security check-update 2>&1 | fgrep 'security'" ` - ph.execIfReady "sudo /usr/bin/yum --security check-update > $_yumout 2>&1" - local summary=$( cat $_yumout | grep security ) + + + # ph.execIfReady "sudo /usr/bin/yum --security check-update > $_yumout 2>&1" + # local summary=$( cat $_yumout | grep security ) + local summary=$( /usr/bin/yum --bugfix check-update 2>&1 | grep security ) + test -z "$summary" && summary='no data .. no packages to install' # example outputs: - # I No packages needed for security; 223 packages available - # II 2 package(s) needed for security, out of 237 available - typeset -i local iPkgSecurity=` echo $summary | cut -f 1 -d ' ' | sed "s#[^0-9]##g"` - typeset -i local iPkg2Update=` echo $summary | cut -f 2- -d ' ' | sed "s#[^0-9]##g"` + # I No packages needed for security; 223 packages available + # II 2 package(s) needed for security, out of 237 available + # III No security updates needed, but 61 updates available << centos 8 stream + typeset -i local iPkgSecurity + iPkgSecurity=$( echo "$summary" | cut -f 1 -d ' ' | sed "s#[^0-9]##g") + typeset -i local iPkg2Update + iPkg2Update=$( echo "$summary" | cut -f 2- -d ' ' | sed "s#[^0-9]##g") # step I: check limits with packages to update: ph.setStatusByLimit ${iPkg2Update} ${iWarnLimit} ${iCriticalLimit} -- GitLab