diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index 5a9d221a4..e121b8277 100644 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -109,6 +109,8 @@ export PATH=/xcatpost:$PATH # use the run_ps subroutine to run the postscripts TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` echo " +# global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed +return_value=0 # subroutine used to run postscripts run_ps () { logdir=\"/var/log/xcat\" @@ -120,8 +122,13 @@ run_ps () { #./\$@ 2>&1 1> /tmp/tmp4xcatlog #cat /tmp/tmp4xcatlog | tee -a \$logfile ./\$@ 2>&1 | tee -a $logfile + ret_local=\${PIPESTATUS[0]} + if [ \"\$ret_local\" -ne \"0\" ]; then + return_value=\$ret_local + fi else echo "\"\`date\` Postscript \$1 does NOT exist.\"" | tee -a \$logfile + return_value=-1 fi } # subroutine end