defect 3819, changes for xcatdsklspost and setuppostbootscripts

This commit is contained in:
lissav 2013-10-15 10:21:53 -04:00
parent 9c7f3e41c0
commit 53974fcaa8
2 changed files with 50 additions and 3 deletions

View File

@ -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

View File

@ -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.