From 53974fcaa8067d4128640d90ba57ed6390f5affd Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 15 Oct 2013 10:21:53 -0400 Subject: [PATCH] defect 3819, changes for xcatdsklspost and setuppostbootscripts --- xCAT/postscripts/setuppostbootscripts | 26 +++++++++++++++++++++++--- xCAT/postscripts/xcatdsklspost | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/setuppostbootscripts b/xCAT/postscripts/setuppostbootscripts index 21cb3df25..48a601be0 100755 --- a/xCAT/postscripts/setuppostbootscripts +++ b/xCAT/postscripts/setuppostbootscripts @@ -16,7 +16,7 @@ if [ "$NODESETSTATE" = "netboot" -o \ "$NODESETSTATE" = "statelite" -o \ "$NODESETSTATE" = "diskless" -o \ "$NODESETSTATE" = "dataless" ]; then - echo "Nothng to do for stateless and statelite node." + logger -t xCAT -p local4.info "setuppostbootscripts: Nothing to do for stateless and statelite nodes." exit 0 fi @@ -24,7 +24,20 @@ fi if [ ! -d "/opt/xcat" ]; then mkdir -p /opt/xcat fi - +infofile="/opt/xcat/xcatinfo" +if [ "$RUNBOOTSCRIPTS" = "yes" ] || [ "$RUNBOOTSCRIPTS" = "YES" ]; then + RUNBOOTSCRIPTS=YES +else + RUNBOOTSCRIPTS=NO +fi +# check to see if current setting is already in the file, if so nothing to do +if [ -f $infofile ]; then + value=`grep "RUNBOOTSCRIPTS=$RUNBOOTSCRIPTS" $infofile` + if [[ -n $value ]]; then # match + logger -t xCAT -p local4.info "setuppostbootscripts: xcatinfo uptodate, nothing to do." + exit 0 + fi +fi #copy the necessary files rsync /xcatpost/xcatdsklspost /opt/xcat/xcatdsklspost rsync /xcatpost/xcatinstallpost /opt/xcat/xcatinstallpost @@ -42,10 +55,11 @@ if [ ! -f "/etc/rc.d/rc5.d/S84xcatpostinit1" ]; then fi #put correct info in /opt/xcat/xcatinfo -infofile="/opt/xcat/xcatinfo" + if [ ! -f $infofile ]; then echo "XCATSERVER=$MASTER" > $infofile echo "REBOOT=TRUE" >> $infofile + echo "RUNBOOTSCRIPTS=$RUNBOOTSCRIPTS" >> $infofile else value=`grep XCATSERVER $infofile` if [[ -n $value ]]; then @@ -59,6 +73,12 @@ else else echo REBOOT=TRUE >> $infofile fi + value=`grep RUNBOOTSCRIPTS $infofile` + if [[ -n $value ]]; then + sed -i "s/^RUNBOOTSCRIPTS=.*$/RUNBOOTSCRIPTS=$RUNBOOTSCRIPTS/" $infofile + else + echo "RUNBOOTSCRIPTS=$RUNBOOTSCRIPTS" >> $infofile + fi fi #enable/disable the running of postscripts according to site.runbootscripts if [[ "$RUNBOOTSCRIPTS" = "yes" ]]; then diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index ea1be0b24..19e031cd7 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -555,6 +555,33 @@ if [ -n "$new_ms" ]; then fi fi +#save the USEFLOWCONTROL into the xcatinfo file +#for updatenode case, passwd in with the -f flag +if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ]; then + useflowcontrol=`grep '^USEFLOWCONTROL' /$xcatpost/mypostscript |cut -d= -f2` +fi +if [ ! -f /opt/xcat/xcatinfo ]; then + mkdir -p /opt/xcat + touch /opt/xcat/xcatinfo +fi +if [ -n "$useflowcontrol" ]; then + # lets just put YES or NO in xcatinfo + if [ "$useflowcontrol" = "1" ] || [ "$useflowcontrol" = "yes" ] || [ "$useflowcontrol" = "YES" ]; then + new_fc="YES" + else + new_fc="NO" + fi + grep 'USEFLOWCONTROL' /opt/xcat/xcatinfo 2>&1 > /dev/null + if [ $? -eq 0 ]; then + sed -i "s/USEFLOWCONTROL=.*/USEFLOWCONTROL=$new_fc/" /opt/xcat/xcatinfo + else + echo "USEFLOWCONTROL=$new_fc" >> /opt/xcat/xcatinfo + fi +# no setting means do not use flowcontrol +else + echo "USEFLOWCONTROL=NO" >> /opt/xcat/xcatinfo +fi + # when called by the updatenode command MODE=1,2 # the nodename is passed in by xdsh in the NODE environment variable by xdsh.