2008-03-20 17:26:54 +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}')
|
2009-07-23 21:03:49 +00:00
|
|
|
hostname $HOSTNAME#
|
|
|
|
# put xCAT post install in init.d process
|
2008-03-20 17:26:54 +00:00
|
|
|
#
|
2009-07-23 21:03:49 +00:00
|
|
|
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
|
|
|
|
TMP=`sed "/IBM(c)/ a ADDSITEYUM=1" /opt/xcat/xcatdsklspost`
|
|
|
|
echo "$TMP" > /opt/xcat/xcatdsklspost
|
|
|
|
chmod 755 /opt/xcat/xcatdsklspost
|
|
|
|
chkconfig --add xcatpostinit
|
|
|
|
|
2008-03-20 17:26:54 +00:00
|
|
|
export MASTER_IP="#XCATVAR:XCATMASTER#"
|
|
|
|
export MASTER_IPS="#XCATVAR:XCATMASTER#"
|
|
|
|
export MASTER="#XCATVAR:XCATMASTER#"
|
2009-07-23 21:03:49 +00:00
|
|
|
mkdir -p /tmp/xcatpost
|
|
|
|
cd /tmp/xcatpost
|
2008-03-20 17:26:54 +00:00
|
|
|
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
|
|
|
sleep $RAND
|
|
|
|
for i in $(seq 1 20)
|
|
|
|
do
|
2009-07-23 21:03:49 +00:00
|
|
|
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" ]
|
2008-03-20 17:26:54 +00:00
|
|
|
then
|
2009-07-23 21:03:49 +00:00
|
|
|
if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
chmod +x /tmp/xcatpost/*
|
|
|
|
GOTIT=1
|
|
|
|
break
|
2008-03-20 17:26:54 +00:00
|
|
|
fi
|
2009-07-23 21:03:49 +00:00
|
|
|
done
|
|
|
|
if [ "$GOTIT" = "1" ]
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
|
|
|
sleep $RAND
|
2008-03-20 17:26:54 +00:00
|
|
|
done
|
2008-04-30 20:54:57 +00:00
|
|
|
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#
|
2008-04-24 21:15:28 +00:00
|
|
|
iscsiadm -m discovery -t st -p #TABLE:iscsi:$NODE:server#
|
2008-05-27 18:21:23 +00:00
|
|
|
sed -i 's/^serial/#serial/' /boot/grub/menu.lst
|
|
|
|
sed -i 's/^terminal/#terminal/' /boot/grub/menu.lst
|
2009-07-23 21:03:49 +00:00
|
|
|
|
|
|
|
#remove all the repos, later addsiteyum will add the one from the master node.
|
|
|
|
rm -f /etc/yum.repos.d/*
|
|
|
|
|
2008-03-20 17:26:54 +00:00
|
|
|
uploadboot
|
|
|
|
exit 0
|