2012-03-23 08:26:38 +00:00
|
|
|
#
|
2014-05-09 09:02:45 +00:00
|
|
|
# Setup hostname
|
2012-03-23 08:26:38 +00:00
|
|
|
#
|
|
|
|
echo "post scripts" >/root/post.log
|
2014-05-08 10:22:23 +00:00
|
|
|
|
|
|
|
|
2012-03-23 08:26:38 +00:00
|
|
|
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
|
|
|
|
if [ "$PRINIC" == "mac" ]
|
|
|
|
then
|
|
|
|
export PRINIC='#TABLE:mac:THISNODE:mac#'
|
|
|
|
fi
|
|
|
|
if [ -z "$PRINIC" ]
|
|
|
|
then
|
|
|
|
for karg in $(cat /proc/cmdline |sed -e 's/-/:/g' -e 's/ /\n/g'); do
|
|
|
|
if [ "${karg%%=*}" = "BOOTIF" ]; then
|
2014-05-30 10:12:08 +00:00
|
|
|
#export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'`
|
|
|
|
export PRINIC=`ip -o link|grep -i "${karg#*=}"|awk '{print $2}'|sed s/://`
|
2012-03-23 08:26:38 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "$PRINIC" ]; then
|
|
|
|
export PRINIC=eth0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z "$PRINIC" ]
|
|
|
|
then
|
|
|
|
export PRINIC=eth0
|
|
|
|
elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then
|
2014-05-30 10:12:08 +00:00
|
|
|
#export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`
|
|
|
|
export PRINIC=`ip -o link|grep -i "$PRINIC"|awk '{print $2}'|sed s/://`
|
2012-03-23 08:26:38 +00:00
|
|
|
fi
|
2014-05-30 10:12:08 +00:00
|
|
|
#IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
|
|
|
IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}')
|
2012-03-23 08:26:38 +00:00
|
|
|
if [ -z $IP ]
|
|
|
|
then
|
|
|
|
dhclient eth0
|
2014-05-30 10:12:08 +00:00
|
|
|
#IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
|
|
|
IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}')
|
2012-03-23 08:26:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
|
|
|
|
hostname $HOSTNAME
|
|
|
|
|
2012-09-10 20:47:52 +00:00
|
|
|
if [ -f /boot/efi/efi/redhat/grub.conf ]; then #RedHat bug, grub.efi corrupts console unless we are careful...
|
|
|
|
sed -i s/^terminal.*// /boot/efi/efi/redhat/grub.conf
|
|
|
|
bootpart=$(sed -e 's/#.*//' /boot/efi/efi/redhat/grub.conf |grep root|grep -v kernel|head -n 1|awk '{print $2}')
|
|
|
|
bootpart="${bootpart%\\n}"
|
|
|
|
sed -i s!^serial.*!splashimage=$bootpart/boot/grub/splash.xpm.gz! /boot/efi/efi/redhat/grub.conf
|
|
|
|
fi
|