formally supporting postscripts.postbootscripts, yeh.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4783 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
f4a01ffd36
commit
1ab1151e5a
@ -21,68 +21,111 @@ done >>/etc/resolv.conf
|
||||
export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
|
||||
hostname $HOSTNAME
|
||||
#
|
||||
# put xCAT post install in init.d process
|
||||
# Run xCAT post install
|
||||
#
|
||||
cat >/etc/init.d/xcatpostinit << 'EOF'
|
||||
#INCLUDE:#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
|
||||
export MASTER_IP="#XCATVAR:XCATMASTER#"
|
||||
export MASTER_IPS="#XCATVAR:XCATMASTER#"
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
sleep $RAND
|
||||
for i in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
#wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.gz
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit
|
||||
exit 1
|
||||
fi
|
||||
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
||||
export USEOPENSSLFORXCAT
|
||||
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=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
|
||||
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
cd /xcatpost
|
||||
#gunzip xcatpost.tar.gz
|
||||
#tar -xvf xcatpost.tar
|
||||
#/xcatpost/#TABLE:nodelist:THISNODE:node#
|
||||
export PATH=/xcatpost:$PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
EOF
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatdsklspost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
|
||||
chkconfig xcatpostinit off
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
TMP=`sed "/IBM(c)/ a ADDSITEYUM=1" /opt/xcat/xcatdsklspost`
|
||||
echo "$TMP" > /opt/xcat/xcatdsklspost
|
||||
chmod 755 /opt/xcat/xcatdsklspost
|
||||
chkconfig --add xcatpostinit
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
|
||||
cat >/opt/xcat/xcatinfo << EOF
|
||||
XCATSERVER=#XCATVAR:XCATMASTER#
|
||||
EOF
|
||||
chkconfig --add xcatpostinit1
|
||||
|
||||
#something Jarrod knows
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
|
||||
/tmp/mypostscript
|
||||
export NODE=#TABLE:nodelist:THISNODE:node#
|
||||
export OSVER=#TABLE:nodetype:THISNODE:os#
|
||||
export ARCH=#TABLE:nodetype:THISNODE:arch#
|
||||
addsiteyum
|
||||
sed -i 's/^serial/#serial/' /boot/grub/menu.lst
|
||||
sed -i 's/^terminal/#terminal/' /boot/grub/menu.lst
|
||||
|
||||
#change the chain from install to boot
|
||||
cat >/tmp/updateflag.awk <<EOF
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
BEGIN {
|
||||
xcatdport = #TABLE:site:key=xcatiport:value#
|
||||
xcatdhost = "#XCATVAR:XCATMASTER#"
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatdport
|
||||
|
||||
while(1) {
|
||||
if((ns |& getline) > 0)
|
||||
print \$0
|
||||
else {
|
||||
print "Retrying update"
|
||||
close(ns)
|
||||
system("sleep 5")
|
||||
}
|
||||
|
||||
if(\$0 == "ready")
|
||||
print "next" |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
||||
EOF
|
||||
chmod 755 /tmp/updateflag.awk
|
||||
/tmp/updateflag.awk
|
||||
|
||||
#remove all the repos, later addsiteyum will add the one from the master node.
|
||||
rm -f /etc/yum.repos.d/*
|
||||
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
exit 0
|
||||
|
||||
|
@ -19,73 +19,112 @@ do
|
||||
echo "nameserver $i"
|
||||
done >>/etc/resolv.conf
|
||||
export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
|
||||
hostname $HOSTNAME#
|
||||
# put xCAT post install in init.d process
|
||||
hostname $HOSTNAME
|
||||
#
|
||||
# Run xCAT post install
|
||||
#
|
||||
cat >/etc/init.d/xcatpostinit << 'EOF'
|
||||
#INCLUDE:#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:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
|
||||
chkconfig xcatpostinit off
|
||||
EOF
|
||||
TMP=`sed "/IBM(c)/ a ADDSITEYUM=1" /opt/xcat/xcatdsklspost`
|
||||
echo "$TMP" > /opt/xcat/xcatdsklspost
|
||||
chmod 755 /opt/xcat/xcatdsklspost
|
||||
chkconfig --add xcatpostinit
|
||||
|
||||
cat >/opt/xcat/xcatinfo << EOF
|
||||
XCATSERVER=#XCATVAR:XCATMASTER#
|
||||
EOF
|
||||
|
||||
export MASTER_IP="#XCATVAR:XCATMASTER#"
|
||||
export MASTER_IPS="#XCATVAR:XCATMASTER#"
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
mkdir -p /tmp/xcatpost
|
||||
cd /tmp/xcatpost
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
sleep $RAND
|
||||
for i in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
wget -l inf -N --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts/uploadboot
|
||||
wget -l inf -N --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts/locktftpdir.awk
|
||||
wget -l inf -N --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts/unlocktftpdir.awk
|
||||
wget -l inf -N --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts/setiscsiparms.awk
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit
|
||||
exit 1;
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
#wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.gz
|
||||
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
|
||||
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
||||
export USEOPENSSLFORXCAT
|
||||
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=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
chmod +x /tmp/xcatpost/*
|
||||
GOTIT=1
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
cd /xcatpost
|
||||
#gunzip xcatpost.tar.gz
|
||||
#tar -xvf xcatpost.tar
|
||||
#/xcatpost/#TABLE:nodelist:THISNODE:node#
|
||||
export PATH=/xcatpost:$PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
EOF
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/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
|
||||
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
|
||||
/tmp/mypostscript
|
||||
export NODE=#TABLE:nodelist:THISNODE:node#
|
||||
export OSVER=#TABLE:nodetype:THISNODE:os#
|
||||
export ARCH=#TABLE:nodetype:THISNODE:arch#
|
||||
addsiteyum
|
||||
iscsiadm -m discovery -t st -p #TABLE:iscsi:$NODE:server#
|
||||
sed -i 's/^serial/#serial/' /boot/grub/menu.lst
|
||||
sed -i 's/^terminal/#terminal/' /boot/grub/menu.lst
|
||||
|
||||
#remove all the repos, later addsiteyum will add the one from the master node.
|
||||
rm -f /etc/yum.repos.d/*
|
||||
export PATH=/xcatpost:/tmp/xcatpost:$PATH
|
||||
uploadboot
|
||||
cd /
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
exit 0
|
||||
|
||||
|
@ -51,29 +51,104 @@ HOSTNAME=$(hostname -s)
|
||||
echo $HOSTNAME
|
||||
|
||||
/sbin/portmap
|
||||
export MASTER_IP=#XCATVAR:XCATMASTER#
|
||||
export MASTER_IPS=#XCATVAR:XCATMASTER#
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
|
||||
cat >/etc/init.d/xcatpostinit << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit#
|
||||
#
|
||||
# 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
|
||||
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
||||
export USEOPENSSLFORXCAT
|
||||
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=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
PATH=/xcatpost:$PATH
|
||||
export PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
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
|
||||
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatdsklspost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
|
||||
chkconfig xcatpostinit off
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatdsklspost
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
|
||||
chkconfig --add xcatpostinit
|
||||
chkconfig --add xcatpostinit1
|
||||
|
||||
cat >/opt/xcat/xcatinfo << EOF
|
||||
XCATSERVER=#XCATVAR:XCATMASTER#
|
||||
EOF
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
/tmp/mypostscript
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
/xcatpost/#TABLE:nodelist:$NODE:node#
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
#rmdir /xcatpost
|
||||
]]>
|
||||
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
|
||||
|
@ -25,29 +25,104 @@ HOSTNAME=$(hostname -s)
|
||||
echo $HOSTNAME
|
||||
|
||||
/sbin/portmap
|
||||
export MASTER_IP=#XCATVAR:XCATMASTER#
|
||||
export MASTER_IPS=#XCATVAR:XCATMASTER#
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
|
||||
cat >/etc/init.d/xcatpostinit << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit#
|
||||
#
|
||||
# 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
|
||||
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
||||
export USEOPENSSLFORXCAT
|
||||
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=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
PATH=/xcatpost:$PATH
|
||||
export PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
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
|
||||
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatdsklspost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
|
||||
chkconfig xcatpostinit off
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatdsklspost
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
|
||||
chkconfig --add xcatpostinit
|
||||
chkconfig --add xcatpostinit1
|
||||
|
||||
cat >/opt/xcat/xcatinfo << EOF
|
||||
XCATSERVER=#XCATVAR:XCATMASTER#
|
||||
EOF
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
/tmp/mypostscript
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
/xcatpost/#TABLE:nodelist:$NODE:node#
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
#rmdir /xcatpost
|
||||
]]>
|
||||
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
|
||||
|
@ -51,29 +51,107 @@ HOSTNAME=$(hostname -s)
|
||||
echo $HOSTNAME
|
||||
|
||||
/sbin/portmap
|
||||
export MASTER_IP=#XCATVAR:XCATMASTER#
|
||||
export MASTER_IPS=#XCATVAR:XCATMASTER#
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
|
||||
cat >/etc/init.d/xcatpostinit << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit#
|
||||
#
|
||||
# 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
|
||||
XCATSERVER=$i: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
|
||||
else
|
||||
exit 1
|
||||
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=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
PATH=/xcatpost:$PATH
|
||||
export PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
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
|
||||
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatdsklspost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
|
||||
chkconfig xcatpostinit off
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatdsklspost
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
|
||||
chkconfig --add xcatpostinit
|
||||
chkconfig --add xcatpostinit1
|
||||
|
||||
cat >/opt/xcat/xcatinfo << EOF
|
||||
XCATSERVER=#XCATVAR:XCATMASTER#
|
||||
EOF
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
|
||||
/tmp/mypostscript
|
||||
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
/xcatpost/#TABLE:nodelist:$NODE:node#
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
#rmdir /xcatpost
|
||||
]]>
|
||||
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
|
||||
|
@ -35,28 +35,101 @@ echo "$MASTER:/install /install nfs timeo=14,intr 1 2" >>/etc/fstab
|
||||
# check the arch for nodetype
|
||||
NODE_ARCH=#TABLE:nodetype:$NODE:arch#
|
||||
|
||||
cat >/etc/init.d/xcatpostinit << 'EOF'
|
||||
#INCLUDE:#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
|
||||
#
|
||||
# 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
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
if [ -x /usr/bin/openssl ]; then
|
||||
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
||||
export USEOPENSSLFORXCAT
|
||||
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=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
PATH=/xcatpost:$PATH
|
||||
export PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
EOF
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatdsklspost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost#
|
||||
chkconfig xcatpostinit off
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
|
||||
chkconfig xcatpostinit1 off
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatdsklspost
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
|
||||
chkconfig --add xcatpostinit
|
||||
chkconfig --add xcatpostinit1
|
||||
|
||||
cat >/opt/xcat/xcatinfo << EOF
|
||||
XCATSERVER=#XCATVAR:XCATMASTER#
|
||||
EOF
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
|
||||
/tmp/mypostscript
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
/xcatpost/#TABLE:nodelist:$NODE:node#
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
#rmdir /xcatpost
|
||||
]]>
|
||||
|
||||
</source>
|
||||
</script>
|
||||
</post-scripts>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user