xcat-core/xCAT-server/share/xcat/install/scripts/post.rh

84 lines
2.0 KiB
Plaintext
Raw Normal View History

#
# 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
#
# put xCAT post install in init.d process
#
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
cat >/opt/xcat/xcatinfo << EOF
XCATSERVER=#XCATVAR:XCATMASTER#
EOF
#something Jarrod knows
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
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/*
exit 0