2007-10-26 22:44:33 +00:00
|
|
|
#
|
|
|
|
# Setup hostname
|
|
|
|
#
|
|
|
|
echo "post scripts" >/root/post.log
|
|
|
|
export PRINIC=#TABLE:noderes:THISNODE:primarynic#
|
|
|
|
if [ -z "$PRINIC" ]
|
|
|
|
then
|
|
|
|
export PRINIC=eth0
|
|
|
|
fi
|
|
|
|
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
|
|
|
if [ -z $IP ]
|
|
|
|
then
|
|
|
|
dhclient eth0
|
|
|
|
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
|
|
|
fi
|
|
|
|
echo "search #TABLE:site:key=domain:value#" >/etc/resolv.conf
|
|
|
|
for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ')
|
|
|
|
do
|
|
|
|
echo "nameserver $i"
|
|
|
|
done >>/etc/resolv.conf
|
|
|
|
export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
|
|
|
|
hostname $HOSTNAME
|
|
|
|
#
|
|
|
|
# Run xCAT post install
|
|
|
|
#
|
|
|
|
export MASTER_IP="#XCATVAR:XCATMASTER#"
|
|
|
|
export MASTER_IPS="#XCATVAR:XCATMASTER#"
|
2008-03-20 17:26:54 +00:00
|
|
|
export MASTER="#XCATVAR:XCATMASTER#"
|
2008-04-30 20:54:57 +00:00
|
|
|
cd /tmp
|
2007-10-26 22:44:33 +00:00
|
|
|
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
|
2008-05-13 17:50:00 +00:00
|
|
|
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
2008-04-30 20:54:57 +00:00
|
|
|
#wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.gz
|
2007-10-26 22:44:33 +00:00
|
|
|
if [ "$?" = "0" ]
|
|
|
|
then
|
2008-04-30 20:54:57 +00:00
|
|
|
if [ -x /usr/sbin/stunnel ]; then #Stop if no stunnel to help the next bit
|
|
|
|
echo client=yes > /etc/stunnel/stunnel.conf
|
|
|
|
echo foreground=yes >> /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
|
|
|
|
|
|
|
|
stunnel &
|
|
|
|
STUN_PID=$!
|
|
|
|
sleep 1
|
|
|
|
fi
|
2008-05-13 17:50:00 +00:00
|
|
|
mv $i/postscripts /xcatpost
|
2008-04-30 20:54:57 +00:00
|
|
|
rm -rf $i
|
|
|
|
chmod +x /xcatpost/*
|
|
|
|
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
|
|
|
chmod +x /tmp/mypostscript
|
2007-10-26 22:44:33 +00:00
|
|
|
GOTIT=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ "$GOTIT" = "1" ]
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
|
|
|
sleep $RAND
|
|
|
|
done
|
2008-04-30 20:54:57 +00:00
|
|
|
cd /xcatpost
|
|
|
|
#gunzip xcatpost.tar.gz
|
|
|
|
#tar -xvf xcatpost.tar
|
|
|
|
#/xcatpost/#TABLE:nodelist:THISNODE:node#
|
2008-03-26 15:04:32 +00:00
|
|
|
export PATH=/xcatpost:$PATH
|
2008-04-30 20:54:57 +00:00
|
|
|
/tmp/mypostscript
|
|
|
|
export NODE=#TABLE:nodelist:THISNODE:node#
|
2008-03-26 15:04:32 +00:00
|
|
|
export OSVER=#TABLE:nodetype:THISNODE:os#
|
|
|
|
export ARCH=#TABLE:nodetype:THISNODE:arch#
|
|
|
|
addsiteyum
|
2008-04-22 14:03:01 +00:00
|
|
|
updateflag.awk $MASTER 3002
|
2007-10-26 22:44:33 +00:00
|
|
|
cd /
|
2008-03-13 18:47:53 +00:00
|
|
|
rm -Rf /xcatpost
|
2008-04-30 20:54:57 +00:00
|
|
|
rm -f /tmp/mypostscript
|
|
|
|
rm -f /etc/stunnel/stunnel.conf
|
2007-10-26 22:44:33 +00:00
|
|
|
exit 0
|