From 95c6c2bc8a4daf105a073a755de20c33a2e3e5cd Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 8 Jan 2013 09:14:19 +0000 Subject: [PATCH] fix defect #3182, add return value for package update in "updatenode -S" git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14799 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/ospkgs | 8 +++++++- xCAT/postscripts/otherpkgs | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/ospkgs b/xCAT/postscripts/ospkgs index d986e93b6..5d311951b 100755 --- a/xCAT/postscripts/ospkgs +++ b/xCAT/postscripts/ospkgs @@ -440,6 +440,7 @@ if ( pmatch "$OSVER" "sles10*" ); then result=`rug update -y --agree-to-third-party-licences` if [ $? -ne 0 ]; then + RETURNVAL=$? logger -t xcat -p local4.info "rug update -y --agree-to-third-party-licences\n $result" echo "ospkgs: rug update -y --agree-to-third-party-licences" echo " $result" @@ -585,6 +586,7 @@ elif ( pmatch "$OSVER" "sles11*" ); then #upgrade the all existing rpms result=`zypper --non-interactive update --auto-agree-with-licenses` if [ $? -ne 0 ]; then + RETURNVAL=$? logger -t xcat -p local4.info "ospkgs: zypper --non-interactive update --auto-agree-with-licenses\n $result" echo "ospkgs: zypper --non-interactive update --auto-agree-with-licenses" echo " $result" @@ -667,7 +669,10 @@ elif ( pmatch "$OSVER" "ubuntu*" ); then # upgrade existing packages command="apt-get -y upgrade" echo "=== $command" - $command + eval $command + if [ $? -ne 0 ]; then + RETURNVAL=$? + fi # install groups (NOTE: It's not clear rpm-like "groups" are supported by dpkg/apt, # but keeping this here doesn't really hurt. Anything that looks like a group will @@ -768,6 +773,7 @@ else #upgrade the existing rpms result=`yum -y upgrade 2>&1` if [ $? -ne 0 ]; then + RETURNVAL=$? logger -t xcat -p local4.info "ospkgs: yum -y upgrade\n $result" echo "ospkgs: yum -y upgrade" echo " $result" diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index c6b8e57a6..1dc372513 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -481,17 +481,26 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do if [ $hasyum -eq 1 ]; then echo "yum -y upgrade" result=`yum -y upgrade 2>&1` + if [ $? -ne 0 ]; then + RETURNVAL=$? + fi logger -p local4.info -t xcat "$result" echo "result" elif [ $haszypper -eq 1 ]; then echo "zypper --non-interactive update --auto-agree-with-license" result=`zypper --non-interactive update --auto-agree-with-license 2>&1` + if [ $? -ne 0 ]; then + RETURNVAL=$? + fi logger -p local4.info -t xcat "$result" echo "$result" elif [ $hasapt -eq 1 ]; then apt_get_update_if_repos_changed $REPOFILE echo "apt-get -y upgrade" result=`apt-get -y upgrade 2>&1` + if [ $? -ne 0 ]; then + RETURNVAL=$? + fi logger -p local4.info -t xcat "$result" echo "$result" fi