diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index d035b9086..9c10ff73d 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -86,6 +86,7 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo break fi RAND=$(perl -e 'print int(rand(5)). "\n"') @@ -135,10 +136,15 @@ ln -s /etc/init.d/xcatpostinit1 /etc/rc2.d/S84xcatpostinit1 mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' #INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# -rm /etc/rc2.d/S84xcatpostinit1 EOF chmod 755 /opt/xcat/xcatinstallpost +#create the dskls post +cat >/opt/xcat/xcatdsklspost << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# +EOF +chmod 755 /opt/xcat/xcatdsklspost + #only run the prebooot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x index da1d2e757..3ad513739 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x @@ -76,6 +76,7 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo break fi RAND=$(perl -e 'print int(rand(5)). "\n"') @@ -129,12 +130,17 @@ mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' # Install directory variable set by nodeset replace_install_dir/postscripts/xcatinstallpost -chkconfig xcatpostinit1 off EOF chmod 755 /opt/xcat/xcatinstallpost chkconfig --add xcatpostinit1 +#create the dskls post +cat >/opt/xcat/xcatdsklspost << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# +EOF +chmod 755 /opt/xcat/xcatdsklspost + # Only run preboot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x index 381308915..eb7cf3f00 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x @@ -76,6 +76,7 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo break fi RAND=$(perl -e 'print int(rand(5)). "\n"') @@ -129,12 +130,17 @@ mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' # Install directory variable set by nodeset replace_install_dir/postscripts/xcatinstallpost -chkconfig xcatpostinit1 off EOF chmod 755 /opt/xcat/xcatinstallpost chkconfig --add xcatpostinit1 +#create the dskls post +cat >/opt/xcat/xcatdsklspost << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# +EOF +chmod 755 /opt/xcat/xcatdsklspost + # Only run preboot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript diff --git a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x index f9f19baee..1db93e712 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x @@ -87,6 +87,7 @@ do fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo break fi @@ -146,13 +147,18 @@ mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' # Install directory variable is set by nodeset replace_install_dir/postscripts/xcatinstallpost -chkconfig xcatpostinit1 off EOF # Change permissions chmod 755 /opt/xcat/xcatinstallpost chkconfig --add xcatpostinit1 +#create the dskls post +cat >/opt/xcat/xcatdsklspost << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# +EOF +chmod 755 /opt/xcat/xcatdsklspost + # Only run prebooot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x index f96a347e7..4f0a72c58 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x @@ -83,6 +83,7 @@ do fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo break fi @@ -141,13 +142,18 @@ mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' # Install directory variable is set by nodeset replace_install_dir/postscripts/xcatinstallpost -chkconfig xcatpostinit1 off EOF # Change permissions chmod 755 /opt/xcat/xcatinstallpost chkconfig --add xcatpostinit1 +#create the dskls post +cat >/opt/xcat/xcatdsklspost << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# +EOF +chmod 755 /opt/xcat/xcatdsklspost + # Only run prebooot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index eaf2420dc..0c133e454 100644 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -88,6 +88,7 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo break fi RAND=$(perl -e 'print int(rand(5)). "\n"') @@ -148,6 +149,12 @@ rm /etc/rc2.d/S84xcatpostinit1 EOF chmod 755 /opt/xcat/xcatinstallpost +#create the dskls post +cat >/opt/xcat/xcatdsklspost << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# +EOF +chmod 755 /opt/xcat/xcatdsklspost + #only run the prebooot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /xcatpost/mypostscript diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 55d3c736a..2023c1fac 100644 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -67,6 +67,7 @@ do sleep $RAND done echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo +echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo cd /xcatpost #gunzip xcatpost.tar.gz #tar -xvf xcatpost.tar @@ -115,12 +116,17 @@ ln -s /etc/init.d/xcatpostinit1 /etc/rc5.d/S84xcatpostinit1 mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' #INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# -chkconfig xcatpostinit1 off EOF chmod 755 /opt/xcat/xcatinstallpost chkconfig --add xcatpostinit1 +#create the dskls post +cat >/opt/xcat/xcatdsklspost << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# +EOF +chmod 755 /opt/xcat/xcatdsklspost + #only run the prebooot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /xcatpost/mypostscript diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 65bda869a..37b85651d 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -4,14 +4,15 @@ # # Generic xCAT post script for diskless nodes # The syntax of this script -# xcatdsklspost {mode} {-m|-M} [postscirpts] -# This script is called in the following different palces: +# xcatdsklspost {mode} {-m|-M} [postscripts] +# This script is called in the following different places: # updatenode -P ... --> xcatdsklspost 1 -m/-M ... # updatenode -S --> xcatdsklspost 2 -m/-M otherpkgs # moncfg rmcmon --> xcatdsklspost 3 configrmcnodes # node deployment --> xcatdsklspost # statelite mode --> xcatdsklspost 4 # update security --> xcatdsklspost 5 -m/-M ... +# node reboot - xcatpostinit1 --> xcatdsklspost 6 # ##################################################### @@ -97,7 +98,7 @@ else POSTSCRIPTS=$4 fi ;; - 3|4) MODE=$1;; + 3|4|6) MODE=$1;; esac fi @@ -323,6 +324,24 @@ if [ "$MODE" = "5" ]; then echo "$TMP" > /xcatpost/mypostscript; fi +#when a diskfull reboot mode +if [ "$MODE" = "6" ]; then + # remove the post scripts so that they are not run on reboot + TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript` + echo "$TMP" > /xcatpost/mypostscript + # get the RUNBOOTSCRIPTS site variable + if [ -f /xcatpost/mypostscript ]; then + RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript |cut -d= -f2` + fi + + # if admdin did not requested running of post boot scripts - then remove PBS + if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then + #remove all the postscripts + TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript` + echo "$TMP" > /xcatpost/mypostscript + fi +fi + # postscript name is specified with the updatenode if [ "XX$POSTSCRIPTS" != "XX" ]; then #remove all the postbootscripts diff --git a/xCAT/postscripts/xcatpostinit1 b/xCAT/postscripts/xcatpostinit1 index f3ae9f4f6..8b630fc9a 100755 --- a/xCAT/postscripts/xcatpostinit1 +++ b/xCAT/postscripts/xcatpostinit1 @@ -31,9 +31,20 @@ stop) echo -n "nothing to stop " ;; start) - # run /opt/xcat/xcatinstallpost - if [ -r /opt/xcat/xcatinstallpost ]; then - /opt/xcat/xcatinstallpost + # check for the REBOOT specified in xcatinfo to run post boot scripts on reboot + if [ -f /opt/xcat/xcatinfo ]; then + REBOOT=`grep 'REBOOT' /opt/xcat/xcatinfo |cut -d= -f2` + fi + # if the xcatdsklspost file exists and this is a reboot - run xcatdsklspost with a mode of 6 + if [ -r /opt/xcat/xcatdsklspost ]; then + if [ "$REBOOT" = "TRUE" ]; then + /opt/xcat/xcatdsklspost 6 + fi + else + # run /opt/xcat/xcatinstallpost + if [ -r /opt/xcat/xcatinstallpost ]; then + /opt/xcat/xcatinstallpost + fi fi ;; esac