2014-11-19 14:42:19 +00:00
|
|
|
#!/bin/bash
|
2009-12-15 14:25:36 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#################################################################
|
|
|
|
#
|
|
|
|
# xCAT script for running postboot scripts for full install case.
|
|
|
|
#################################################################
|
|
|
|
|
2011-08-17 23:01:29 +00:00
|
|
|
if [ ! `uname` = Linux ]; then
|
2012-05-15 08:06:23 +00:00
|
|
|
logger -t xcat -p local4.err "$0: the OS name is not Linux"
|
2009-12-15 14:25:36 +00:00
|
|
|
exit
|
|
|
|
fi
|
2011-08-17 23:01:29 +00:00
|
|
|
SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*10)}')
|
2009-12-15 14:25:36 +00:00
|
|
|
sleep $SLI
|
|
|
|
|
2014-08-26 04:28:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
#the nics have not been configured when running the PBS sometimes, need to make sure...
|
|
|
|
RETRY=0
|
|
|
|
until ip -4 --oneline addr show|grep -v 127.0.0.1 >/dev/null
|
|
|
|
do
|
|
|
|
sleep 2
|
|
|
|
RETRY=$[ $RETRY + 1 ]
|
|
|
|
if [ $RETRY -eq 15 ];then
|
|
|
|
logger -t xcat -p local4.err "Network not configured, please check..."
|
|
|
|
echo `date` "xcatinstallpost: Network not configured, please check..." >> /var/log/xcat/xcat.log
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-15 14:25:36 +00:00
|
|
|
cd /xcatpost;
|
|
|
|
PATH=/xcatpost:$PATH
|
|
|
|
export PATH
|
2013-11-12 08:42:03 +00:00
|
|
|
# To support the postscripts in the subdirectories under /install/postscripts
|
|
|
|
#chmod +x /xcatpost/*;
|
|
|
|
chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'`
|
2009-12-15 14:25:36 +00:00
|
|
|
|
2012-03-29 03:16:38 +00:00
|
|
|
POST_IN_DIR="/xcatpost"
|
2011-08-17 02:40:40 +00:00
|
|
|
|
2010-03-17 14:37:20 +00:00
|
|
|
if [ -x /usr/bin/openssl ]; then
|
2011-08-17 02:40:40 +00:00
|
|
|
SIP=`grep "^MASTER=" ${POST_IN_DIR}/mypostscript.post |cut -d= -f2`
|
2010-03-17 14:37:20 +00:00
|
|
|
XCATSERVER="$SIP:3001"
|
|
|
|
export XCATSERVER
|
|
|
|
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
|
|
|
export USEOPENSSLFORXCAT
|
|
|
|
fi
|
2009-12-15 14:25:36 +00:00
|
|
|
|
2012-03-29 03:16:38 +00:00
|
|
|
# Regardless of where mypostscript.post was found, modify and run it in /xcatpost.
|
2009-12-15 14:25:36 +00:00
|
|
|
|
2012-03-29 03:16:38 +00:00
|
|
|
DHCP_TMP=`sed 's/\(DHCPINTERFACES=\)\(.*\)$/\1"\2"/' /xcatpost/mypostscript.post`
|
|
|
|
echo "$DHCP_TMP" > /xcatpost/mypostscript.post
|
2009-12-15 14:25:36 +00:00
|
|
|
|
2012-09-17 11:12:39 +00:00
|
|
|
#mark that the first reboot after installation is finished
|
|
|
|
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
|
|
|
|
|
2012-09-14 02:15:23 +00:00
|
|
|
CNS=`grep NODESTATUS= /xcatpost/mypostscript.post |awk -F = '{print $2}'`
|
|
|
|
if [ -z "$CNS" ] || [ "$CNS" != "'0'" -a "$CNS" != "'N'" -a "$CNS" != "'n'" ]; then
|
|
|
|
#update the node status during the postbootscript running
|
|
|
|
#TMP=`sed "/postbootscripts-start-here/ i\updateflag.awk \\$MASTER 3002 \\"installstatus configuring\\"" /xcatpost/mypostscript.post`
|
|
|
|
#echo "$TMP"> /xcatpost/mypostscript.post
|
|
|
|
|
|
|
|
echo "
|
|
|
|
if [ \"\$return_value\" -eq \"0\" ]; then
|
|
|
|
updateflag.awk \$MASTER 3002 \"installstatus booted\"
|
|
|
|
else
|
|
|
|
updateflag.awk \$MASTER 3002 \"installstatus failed\"
|
|
|
|
fi
|
|
|
|
" >> /xcatpost/mypostscript.post
|
|
|
|
fi
|
2009-12-15 14:25:36 +00:00
|
|
|
|
2012-03-29 03:16:38 +00:00
|
|
|
chmod +x /xcatpost/mypostscript.post
|
|
|
|
if [ -x /xcatpost/mypostscript.post ];then
|
|
|
|
/xcatpost/mypostscript.post
|
2011-08-13 17:54:25 +00:00
|
|
|
fi
|