moved the xCAT postscripts to init.d process for full install for SLES

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3755 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2009-07-10 18:34:09 +00:00
parent 529e858d84
commit a525edd2fc
7 changed files with 86 additions and 226 deletions

View File

@ -64,7 +64,7 @@ sub subvars {
$doneincludes=1;
if ($inc =~ /#INCLUDE:[^#]+#/) {
$doneincludes=0;
$inc =~ s/#INCLUDE:([^#]+)#/includefile($1)/eg;
$inc =~ s/#INCLUDE:([^#]+)#/includefile($1, 0)/eg;
}
}
#ok, now do everything else..
@ -74,6 +74,8 @@ sub subvars {
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
$inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
$inc =~ s/#INCLUDE_NOP:([^#]+)#/includefile($1,1)/eg;
if ($tmplerr) {
close ($outh);
return $tmplerr;
@ -84,23 +86,29 @@ sub subvars {
}
sub includefile
{
my $file = shift;
my $text = "";
my $file = shift;
my $special=shift;
my $text = "";
unless ($file =~ /^\//) {
$file = $idir."/".$file;
}
open(INCLUDE,$file) || \
return "#INCLUDEBAD:cannot open $file#";
open(INCLUDE,$file) || \
return "#INCLUDEBAD:cannot open $file#";
while(<INCLUDE>) {
$text .= "$_";
}
close(INCLUDE);
if ($special) {
$text =~ s/\$/\\\$/g;
$text =~ s/`/\\`/g;
}
while(<INCLUDE>) {
$text .= "$_";
}
close(INCLUDE);
chomp($text);
return($text);
chomp($text);
return($text);
}
sub command

View File

@ -51,59 +51,23 @@ HOSTNAME=$(hostname -s)
echo $HOSTNAME
/sbin/portmap
export MASTER_IP=#XCATVAR:XCATMASTER#
export MASTER_IPS=#XCATVAR:XCATMASTER#
export MASTER="#XCATVAR:XCATMASTER#"
#
# This script has not yet been updated to work with service nodes
#
for i in $(seq 1 20)
do
GOTIT=0
for i in $MASTER_IPS
do
#mount -r $i:/install/postscripts /xcatpost
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
if [ "$?" = "0" ]
then
if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit
exit 1
fi
XCATSERVER=$i:3001
export XCATSERVER
mv $i/postscripts /xcatpost
rm -rf $i
chmod +x /xcatpost/*
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
while [ -z "$MYCONT" ]; do
let SLI=$RANDOM%10+10
sleep $SLI
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
done
chmod +x /tmp/mypostscript
GOTIT=1
break
fi
done
if [ "$GOTIT" = "1" ]
then
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
sleep $RAND
done
PATH=/xcatpost:$PATH
export PATH
/tmp/mypostscript
updateflag.awk $MASTER 3002
cd /
/xcatpost/#TABLE:nodelist:$NODE:node#
rm -Rf /xcatpost
rm -f /tmp/mypostscript
rmdir /xcatpost
cat >/etc/init.d/xcatpostinit << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit#
EOF
chmod 755 /etc/init.d/xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc3.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc4.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc5.d/S84xcatpostinit
mkdir -p /opt/xcat
cat >/opt/xcat/xcatdsklspost << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
chkconfig xcatpostinit off
EOF
chmod 755 /opt/xcat/xcatdsklspost
chkconfig --add xcatpostinit
]]>
</source>

View File

@ -25,59 +25,23 @@ HOSTNAME=$(hostname -s)
echo $HOSTNAME
/sbin/portmap
export MASTER_IP=#XCATVAR:XCATMASTER#
export MASTER_IPS=#XCATVAR:XCATMASTER#
export MASTER="#XCATVAR:XCATMASTER#"
#
# This script has not yet been updated to work with service nodes
#
for i in $(seq 1 20)
do
GOTIT=0
for i in $MASTER_IPS
do
#mount -r $i:/install/postscripts /xcatpost
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
if [ "$?" = "0" ]
then
if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit
exit 1
fi
XCATSERVER=$i:3001
export XCATSERVER
mv $i/postscripts /xcatpost
rm -rf $i
chmod +x /xcatpost/*
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
while [ -z "$MYCONT" ]; do
let SLI=$RANDOM%10+10
sleep $SLI
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
done
chmod +x /tmp/mypostscript
GOTIT=1
break
fi
done
if [ "$GOTIT" = "1" ]
then
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
sleep $RAND
done
PATH=/xcatpost:$PATH
export PATH
/tmp/mypostscript
updateflag.awk $MASTER 3002
cd /
/xcatpost/#TABLE:nodelist:$NODE:node#
rm -Rf /xcatpost
rm -f /tmp/mypostscript
rmdir /xcatpost
cat >/etc/init.d/xcatpostinit << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit#
EOF
chmod 755 /etc/init.d/xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc3.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc4.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc5.d/S84xcatpostinit
mkdir -p /opt/xcat
cat >/opt/xcat/xcatdsklspost << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
chkconfig xcatpostinit off
EOF
chmod 755 /opt/xcat/xcatdsklspost
chkconfig --add xcatpostinit
]]>
</source>

View File

@ -51,62 +51,23 @@ HOSTNAME=$(hostname -s)
echo $HOSTNAME
/sbin/portmap
export MASTER_IP=#XCATVAR:XCATMASTER#
export MASTER_IPS=#XCATVAR:XCATMASTER#
export MASTER="#XCATVAR:XCATMASTER#"
#
# This script has not yet been updated to work with service nodes
#
for i in $(seq 1 20)
do
GOTIT=0
for i in $MASTER_IPS
do
#mount -r $i:/install/postscripts /xcatpost
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
cat >/etc/init.d/xcatpostinit << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit#
EOF
chmod 755 /etc/init.d/xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc3.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc4.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc5.d/S84xcatpostinit
if [ "$?" = "0" ]
then
if [ -x /usr/bin/openssl ]; then
XCATSERVER=$i:3001
export XCATSERVER
else
exit 1
fi
fi
mv $i/postscripts /xcatpost
rm -rf $i
chmod +x /xcatpost/*
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
while [ -z "$MYCONT" ]; do
let SLI=$RANDOM%10+10
sleep $SLI
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
done
chmod +x /tmp/mypostscript
GOTIT=1
break
fi
done
if [ "$GOTIT" = "1" ]
then
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
sleep $RAND
done
PATH=/xcatpost:$PATH
export PATH
/tmp/mypostscript
updateflag.awk $MASTER 3002
cd /
/xcatpost/#TABLE:nodelist:$NODE:node#
rm -Rf /xcatpost
rm -f /tmp/mypostscript
rmdir /xcatpost
mkdir -p /opt/xcat
cat >/opt/xcat/xcatdsklspost << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
chkconfig xcatpostinit off
EOF
chmod 755 /opt/xcat/xcatdsklspost
chkconfig --add xcatpostinit
]]>
</source>

View File

@ -35,54 +35,22 @@ echo "$MASTER:/install /install nfs timeo=14,intr 1 2" >>/etc/fstab
# check the arch for nodetype
NODE_ARCH=#TABLE:nodetype:$NODE:arch#
#
# This script has not yet been updated to work with service nodes
#
for i in $(seq 1 20)
do
GOTIT=0
for i in $MASTER_IPS
do
#mount -r $i:/install/postscripts /xcatpost
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/post/otherpkgs/sles11/$NODE_ARCH
cat >/etc/init.d/xcatpostinit << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit#
EOF
chmod 755 /etc/init.d/xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc3.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc4.d/S84xcatpostinit
ln -s /etc/init.d/xcatpostinit /etc/init.d/rc5.d/S84xcatpostinit
if [ "$?" = "0" ]
then
XCATSERVER=$i:3001
export XCATSERVER
mv $i/postscripts /xcatpost
rm -rf $i
chmod +x /xcatpost/*
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
while [ -z "$MYCONT" ]; do
let SLI=$RANDOM%10+10
sleep $SLI
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`cat /tmp/mypostscript`
done
chmod +x /tmp/mypostscript
GOTIT=1
break
fi
done
if [ "$GOTIT" = "1" ]
then
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
sleep $RAND
done
PATH=/xcatpost:$PATH
export PATH
/tmp/mypostscript
updateflag.awk $MASTER 3002
cd /
/xcatpost/#TABLE:nodelist:$NODE:node#
rm -Rf /xcatpost
rm -f /tmp/mypostscript
rmdir /xcatpost
mkdir -p /opt/xcat
cat >/opt/xcat/xcatdsklspost << EOF
#INCLUDE_NOP:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
chkconfig xcatpostinit off
EOF
chmod 755 /opt/xcat/xcatdsklspost
chkconfig --add xcatpostinit
]]>
</source>

View File

@ -110,10 +110,3 @@ if [ $# -gt 0 ]; then
echo "returned"
fi

View File

@ -13,7 +13,9 @@
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
case $1 in
restart)