diff --git a/xCAT/postscripts/ospkgs b/xCAT/postscripts/ospkgs index 3c3a66bd4..40d34d3c0 100755 --- a/xCAT/postscripts/ospkgs +++ b/xCAT/postscripts/ospkgs @@ -423,8 +423,9 @@ if ( pmatch "$OSVER" "sles10*" ); then fi result=`rug update -y --agree-to-third-party-licences` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R 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" @@ -440,8 +441,9 @@ if ( pmatch "$OSVER" "sles10*" ); then if [ -n "$groups" ]; then cmd="$ENVLIST rug install -y --agree-to-third-party-licences -t pattern $groups" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd\n $result" echo "ospkgs: $cmd" echo $result @@ -457,8 +459,9 @@ if ( pmatch "$OSVER" "sles10*" ); then if [ -n "$pkgs" ]; then cmd="$ENVLIST rug install -y --agree-to-third-party-licences $pkgs" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd\n $result" echo "ospkgs: $cmd" echo $result @@ -474,8 +477,9 @@ if ( pmatch "$OSVER" "sles10*" ); then if [ -n "$pkgs_d" ]; then cmd="$ENVLIST rug remove -y $pkgs_d" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd\n $result" echo "ospkgs: $cmd" echo $result @@ -571,8 +575,9 @@ elif ( pmatch "$OSVER" "sles11*" ); then #upgrade the all existing rpms result=`zypper --non-interactive update --auto-agree-with-licenses` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R 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" @@ -587,8 +592,9 @@ elif ( pmatch "$OSVER" "sles11*" ); then if [ -n "$groups" ]; then cmd="$ENVLIST zypper install -y --auto-agree-with-licenses -t pattern $groups" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd\n $result" echo "ospkgs: $cmd" echo $result @@ -604,8 +610,9 @@ elif ( pmatch "$OSVER" "sles11*" ); then if [ -n "$pkgs" ]; then cmd="$ENVLIST zypper install -y --auto-agree-with-licenses $pkgs" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd $result" echo "ospkgs: $cmd" echo $result @@ -621,8 +628,9 @@ elif ( pmatch "$OSVER" "sles11*" ); then if [ -n "$pkgs_d" ]; then cmd="$ENVLIST zypper remove -y $pkgs_d" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd $result" echo "ospkgs: $cmd" echo $result @@ -656,8 +664,9 @@ elif ( pmatch "$OSVER" "ubuntu*" ); then command="apt-get -y upgrade" echo "=== $command" eval $command - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi # install groups (NOTE: It's not clear rpm-like "groups" are supported by dpkg/apt, @@ -667,8 +676,9 @@ elif ( pmatch "$OSVER" "ubuntu*" ); then command="$ENVLIST apt-get -q -y --force-yes install $groups" echo "=== $command" eval $command - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi fi @@ -677,8 +687,9 @@ elif ( pmatch "$OSVER" "ubuntu*" ); then command="$ENVLIST apt-get -q -y --force-yes install $pkgs" echo "=== $command" eval $command - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi fi @@ -687,8 +698,9 @@ elif ( pmatch "$OSVER" "ubuntu*" ); then command="$ENVLIST apt-get -y remove $pkgs_d" echo "=== $command" eval $command - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi fi else @@ -743,8 +755,9 @@ else #upgrade the existing rpms result=`yum -y upgrade 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: yum -y upgrade\n $result" echo "ospkgs: yum -y upgrade" echo " $result" @@ -759,8 +772,9 @@ else if [ -n "$groups" ]; then cmd="echo $groups| $ENVLIST xargs yum -y groupinstall" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd\n $result" echo "ospkgs: $cmd" echo $result @@ -776,8 +790,9 @@ else if [ -n "$pkgs" ]; then cmd="$ENVLIST yum -y install $pkgs" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd\n $result" echo "ospkgs: $cmd" echo $result @@ -793,8 +808,9 @@ else if [ -n "$pkgs_d" ]; then cmd="$ENVLIST yum -y remove $pkgs_d" result=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R logger -t xcat -p local4.info "ospkgs: $cmd\n $result" echo "ospkgs: $cmd" echo $result diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index df8d504d1..8632f0961 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -721,16 +721,19 @@ 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=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R 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=$? + + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" @@ -738,8 +741,9 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do apt_get_update_if_repos_changed $REPOFILE echo "apt-get -y upgrade" result=`apt-get -y upgrade 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" @@ -754,25 +758,28 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do if [ $hasyum -eq 1 ]; then echo "$envlist yum -y remove $repo_pkgs_preremove" result=`eval $envlist yum -y remove $repo_pkgs_preremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" elif [ $haszypper -eq 1 ]; then echo "$envlist zypper remove -y $repo_pkgs_preremove" result=`eval $envlist zypper remove -y $repo_pkgs_preremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? - fi + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R + 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 remove $repo_pkgs_preremove" result=`apt-get -y remove $repo_pkgs_preremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" @@ -782,8 +789,9 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do if [ "$plain_pkgs_preremove" != "" ]; then echo "$envlist $sremovecommand $plain_pkgs_preremove" result=`eval $envlist $sremovecommand $plain_pkgs_preremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" @@ -795,16 +803,18 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do if [ $hasyum -eq 1 ]; then echo "$envlist yum -y install $repo_pkgs" result=`eval $envlist yum -y install $repo_pkgs 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" elif [ $haszypper -eq 1 ]; then echo "$envlist zypper install -y $repo_pkgs" result=`eval $envlist zypper install -y $repo_pkgs 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" @@ -818,8 +828,9 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do apt_get_update_if_repos_changed $REPOFILE echo "$envlist apt-get -q -y --force-yes install $repo_pkgs" result=`eval $envlist apt-get -q -y --force-yes install $repo_pkgs 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R fi logger -p local4.info -t xcat "$result" echo "$result" @@ -850,9 +861,10 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do echo "$envlist $supdatecommand $plain_pkgs" result=`eval $envlist $supdatecommand $plain_pkgs 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? - fi + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R + fi logger -p local4.info -t xcat "$result" echo "$result" @@ -869,26 +881,29 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do if [ $hasyum -eq 1 ]; then echo "$envlist yum -y remove $repo_pkgs_postremove" result=`eval $envlist yum -y remove $repo_pkgs_postremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? - fi + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R + fi logger -p local4.info -t xcat "$result" echo "$result" elif [ $haszypper -eq 1 ]; then echo "$envlist zypper remove -y $repo_pkgs_postremove" result=`eval $envlist zypper remove -y $repo_pkgs_postremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? - fi + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R + fi logger -p local4.info -t xcat "$result" echo "$result" elif [ $hasapt -eq 1 ]; then apt_get_update_if_repos_changed $REPOFILE echo "$envlist apt-get -y remove $repo_pkgs_postremove" result=`eval $envlist apt-get -y remove $repo_pkgs_postremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? - fi + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R + fi logger -p local4.info -t xcat "$result" echo "$result" fi @@ -897,9 +912,10 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do if [ "$plain_pkgs_postremove" != "" ]; then echo "$envlist $sremovecommand $plain_pkgs_postremove" result=`eval $envlist $sremovecommand $plain_pkgs_postremove 2>&1` - if [ $? -ne 0 ]; then - RETURNVAL=$? - fi + R=$? + if [ $R -ne 0 ]; then + RETURNVAL=$R + fi logger -p local4.info -t xcat "$result" echo "$result" fi