2009-03-24 07:48:38 +00:00
|
|
|
<post-scripts config:type="list">
|
|
|
|
<script>
|
|
|
|
<filename>xcat.sh</filename>
|
|
|
|
<interpreter>shell</interpreter>
|
|
|
|
<source>
|
|
|
|
|
|
|
|
<![CDATA[
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
cd /etc/sysconfig/network
|
|
|
|
rm -f ifcfg-eth-id*
|
|
|
|
rm -f ifcfg-myri*
|
|
|
|
cat >ifcfg-eth0 <<EOF
|
|
|
|
DEVICE=eth0
|
|
|
|
BOOTPROTO=dhcp
|
|
|
|
STARTMODE=onboot
|
|
|
|
EOF
|
|
|
|
|
|
|
|
export PRINIC=#TABLE:noderes:$NODE:primarynic#
|
|
|
|
if [ -z "$PRINIC" ]; then
|
|
|
|
export PRINIC=eth0
|
|
|
|
fi
|
|
|
|
if [ "$PRINIC" != "eth0" ]
|
|
|
|
then
|
|
|
|
cd /etc/sysconfig/network
|
|
|
|
if [ ! -r ifcfg-$PRINIC ]
|
|
|
|
then
|
|
|
|
cp -f ifcfg-eth0 ifcfg-$PRINIC
|
|
|
|
perl -pi -e "s/eth0/$PRINIC/" ifcfg-$PRINIC
|
|
|
|
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
perl -pi -e 's/^FIREWALL="yes"/FIREWALL="no"/' /etc/sysconfig/network/config
|
|
|
|
/etc/init.d/network restart
|
|
|
|
|
|
|
|
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
|
|
|
sleep $RAND
|
|
|
|
jsi=0
|
|
|
|
while [ $(hostname) == 'linux' ]
|
|
|
|
do
|
|
|
|
if [ $jsi -gt 10 ]; then
|
|
|
|
logger "Slept too long!"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
let jsi=jsi+1
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo "Slept $jsi seconds before hostname made sense."
|
|
|
|
|
|
|
|
HOSTNAME=$(hostname -s)
|
|
|
|
echo $HOSTNAME
|
|
|
|
|
|
|
|
/sbin/portmap
|
|
|
|
export MASTER_IP=#XCATVAR:XCATMASTER#
|
|
|
|
export MASTER_IPS=#XCATVAR:XCATMASTER#
|
|
|
|
export MASTER="#XCATVAR:XCATMASTER#"
|
|
|
|
|
2009-04-06 17:02:54 +00:00
|
|
|
# for servicenode, add /install to /etc/fstab
|
|
|
|
echo "$MASTER:/install /install nfs timeo=14,intr 1 2" >>/etc/fstab
|
|
|
|
|
2009-04-08 08:24:26 +00:00
|
|
|
# check the arch for nodetype
|
|
|
|
NODE_ARCH=#TABLE:nodetype:$NODE:arch#
|
2009-04-06 17:02:54 +00:00
|
|
|
|
2009-03-24 07:48:38 +00:00
|
|
|
#
|
|
|
|
# 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
|
2009-04-08 08:24:26 +00:00
|
|
|
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/post/otherpkgs/sles11/$NODE_ARCH
|
2009-03-24 07:48:38 +00:00
|
|
|
|
|
|
|
if [ "$?" = "0" ]
|
|
|
|
then
|
2009-04-08 14:53:10 +00:00
|
|
|
if [ -x /usr/bin/openssl ]; then
|
2009-04-08 14:44:16 +00:00
|
|
|
USEOPENSSLFORXCAT=1
|
|
|
|
export USEOPENSSLFORXCAT
|
2009-04-08 16:56:13 +00:00
|
|
|
XCATSERVER=$i:3001
|
|
|
|
export XCATSERVER
|
2009-04-08 14:44:16 +00:00
|
|
|
else
|
|
|
|
rpm -ivh $i/post/otherpkgs/sles11/$NODE_ARCH/stunnel*.rpm
|
|
|
|
mkdir -p /usr/var/run/stunnel
|
|
|
|
mkdir -p /var/stunnel
|
|
|
|
if [ -x /usr/sbin/stunnel ]; then #Stop if no stunnel to help the next bit
|
|
|
|
echo client=yes > /etc/stunnel/stunnel.conf
|
|
|
|
echo foreground=no >> /etc/stunnel/stunnel.conf
|
|
|
|
echo output=/dev/null >> /etc/stunnel/stunnel.conf
|
|
|
|
echo verify=0 >> /etc/stunnel/stunnel.conf
|
|
|
|
echo '[xcatd]' >> /etc/stunnel/stunnel.conf
|
|
|
|
echo accept=400 >> /etc/stunnel/stunnel.conf
|
|
|
|
echo connect=$i:3001 >> /etc/stunnel/stunnel.conf
|
2009-03-24 07:48:38 +00:00
|
|
|
|
2009-04-08 14:44:16 +00:00
|
|
|
stunnel
|
|
|
|
STUN_PID=$!
|
|
|
|
sleep 1
|
|
|
|
fi
|
2009-03-24 07:48:38 +00:00
|
|
|
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
|
2009-04-08 14:44:16 +00:00
|
|
|
if [ ! -x /usr/bin/stunnel ]; then
|
|
|
|
rm -f /etc/stunnel/stunnel.conf
|
|
|
|
fi
|
2009-03-24 07:48:38 +00:00
|
|
|
rmdir /xcatpost
|
|
|
|
]]>
|
|
|
|
|
|
|
|
</source>
|
|
|
|
</script>
|
|
|
|
</post-scripts>
|