2012-03-23 08:26:38 +00:00
|
|
|
#!/bin/sh
|
2014-04-11 09:40:34 +00:00
|
|
|
export MANAGEDADDRESSMODE="#XCATVAR:MANAGEDADDRESSMODE#"
|
2012-03-23 08:26:38 +00:00
|
|
|
|
|
|
|
cd /etc/sysconfig/network
|
2014-04-11 09:40:34 +00:00
|
|
|
|
|
|
|
if [ "$MANAGEDADDRESSMODE" != "static" ]
|
|
|
|
then
|
2012-03-23 08:26:38 +00:00
|
|
|
rm -f ifcfg-eth-id*
|
|
|
|
rm -f ifcfg-myri*
|
|
|
|
cat >ifcfg-eth0 <<EOF
|
|
|
|
DEVICE=eth0
|
|
|
|
BOOTPROTO=dhcp
|
|
|
|
STARTMODE=onboot
|
|
|
|
EOF
|
2014-04-11 09:40:34 +00:00
|
|
|
fi
|
2012-03-23 08:26:38 +00:00
|
|
|
. /tmp/prinicsetting
|
|
|
|
rm /tmp/prinicsetting
|
|
|
|
if [ "$PRINIC" != "eth0" ]
|
|
|
|
then
|
|
|
|
cd /etc/sysconfig/network
|
|
|
|
if [ ! -r ifcfg-$PRINIC ]
|
|
|
|
then
|
|
|
|
# cp -f ifcfg-eth0 ifcfg-$PRINIC
|
|
|
|
mv -f ifcfg-eth0 ifcfg-$PRINIC
|
|
|
|
perl -pi -e "s/eth0/$PRINIC/" ifcfg-$PRINIC
|
|
|
|
# echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
|
|
|
|
fi
|
|
|
|
fi
|
2014-04-11 09:40:34 +00:00
|
|
|
|
|
|
|
if [ "$MANAGEDADDRESSMODE" != "static" ]
|
|
|
|
then
|
2012-03-23 08:26:38 +00:00
|
|
|
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
|
2014-04-11 09:40:34 +00:00
|
|
|
fi
|
|
|
|
|
2012-03-23 08:26:38 +00:00
|
|
|
perl -pi -e 's/^FIREWALL="yes"/FIREWALL="no"/' /etc/sysconfig/network/config
|
|
|
|
/etc/init.d/network restart
|
|
|
|
|
|
|
|
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
|
|
|
sleep $RAND
|
|
|
|
jsi=0
|
|
|
|
while [ $(hostname) == 'linux' ]
|
|
|
|
do
|
|
|
|
if [ $jsi -gt 10 ]; then
|
|
|
|
logger "Slept too long!"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
let jsi=jsi+1
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo "Slept $jsi seconds before hostname made sense."
|
|
|
|
|
|
|
|
HOSTNAME=$(hostname -s)
|
|
|
|
echo $HOSTNAME
|
|
|
|
|
|
|
|
/sbin/portmap
|
|
|
|
|