From a1b47e3ed1dbc18ce8e977bb270561dd065dbb20 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 1 Feb 2013 08:17:57 +0000 Subject: [PATCH] support postscripts return status on ubuntu git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15031 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/install/scripts/post.ubuntu | 7 +++++++ 1 file changed, 7 insertions(+) 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