diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 2179b2f82..48024de9c 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -180,6 +180,7 @@ 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 # \$1 argument is the script type # rest argument is the script name and arguments @@ -227,6 +228,7 @@ run_ps () { return_value=-1 fi + return 0 } # subroutine end @@ -389,6 +391,19 @@ fi #create the preboot script and run here TMP=`sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /xcatpost/mypostscript + +echo " +#save bad return code to /opt/xcat/xcatinfo +if [ \"\$return_value\" -ne \"0\" ]; then + grep 'POSTSCRIPTS_RC' /opt/xcat/xcatinfo > /dev/null 2>&1 + if [ \$? -eq 0 ]; then + sed -i \"s/POSTSCRIPTS_RC=.*/POSTSCRIPTS_RC=1/\" /opt/xcat/xcatinfo + else + echo \"POSTSCRIPTS_RC=1\" >> /opt/xcat/xcatinfo + fi +fi +" >> /xcatpost/mypostscript + chmod 755 /xcatpost/mypostscript export ARCH=#TABLE:nodetype:THISNODE:arch# diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 598cb93d4..de68037f0 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -84,6 +84,9 @@ if [ -z "$CNS" ] || [[ "$CNS" =~ ^(1|yes|y)$ ]]; then echo " +[ -f /opt/xcat/xcatinfo ] && grep 'POSTSCRIPTS_RC=1' /opt/xcat/xcatinfo >/dev/null 2>&1 && return_value=1 + + if [ \"\$return_value\" -eq \"0\" ]; then if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then msgutil_r \"\$MASTER_IP\" \"info\" \"node booted, reporting status...\" \"/var/log/xcat/xcat.log\" @@ -99,6 +102,7 @@ fi " >> /xcatpost/mypostscript.post fi + chmod +x /xcatpost/mypostscript.post if [ -x /xcatpost/mypostscript.post ];then msgutil_r "$MASTER_IP" "info" "running /xcatpost/mypostscript.post" "/var/log/xcat/xcat.log"