Updates to support postbootscripts on reboot

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13687 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jwsimpson 2012-08-31 15:52:31 +00:00
parent 804db0fabd
commit e9a96fbfbe
9 changed files with 85 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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