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

55 lines
1.4 KiB
Plaintext

#
# Setup hostname
#
echo "post scripts" >/root/post.log
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
if [ -z "$PRINIC" ]
then
for karg in $(cat /proc/cmdline |sed -e 's/-/:/g' -e 's/ /\n/g'); do
if [ "${karg%%=*}" = "BOOTIF" ]; then
export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'`
fi
done
if [ -z "$PRINIC" ]; then
export PRINIC=eth0
fi
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
hostname $HOSTNAME
#
# Run xCAT post install
#
export MASTER_IP="#XCATVAR:XCATMASTER#"
export MASTER_IPS="#XCATVAR:XCATMASTER#"
export MASTER="#XCATVAR:XCATMASTER#"
cd /tmp
mkdir -p /xcatpost
service portmap start
ifconfig
cat /etc/resolv.conf
mount $MASTER_IP:/install/postscripts /xcatpost
cd /xcatpost
export PATH=$PATH:/xcatpost
export NODE=#TABLE:nodelist:THISNODE:node#
export OSVER=#TABLE:nodetype:THISNODE:os#
export ARCH=#TABLE:nodetype:THISNODE:arch#
syslog
#remoteshell this has been added in setupesx
setupntp
setupesx $HOSTNAME
updateflag.awk $MASTER #TABLE:site:key=xcatiport:value#
umount /xcatpost
cd /
exit 0