2011-07-19 15:00:21 +00:00
|
|
|
#!/bin/sh
|
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
2011-07-14 17:03:00 +00:00
|
|
|
if [ $reason = "PREINIT" -o $reason = "PREINIT6" ]; then
|
|
|
|
ip link set $interface up
|
2011-09-16 19:15:58 +00:00
|
|
|
tries=50
|
2011-07-14 17:03:00 +00:00
|
|
|
while ! (ip link show $interface|grep LOWER_UP > /dev/null 2>&1); do
|
|
|
|
sleep 0.1
|
2011-09-16 19:15:58 +00:00
|
|
|
if [ $tries = 0 ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
tries=$((tries-1))
|
2011-07-14 17:03:00 +00:00
|
|
|
done
|
|
|
|
elif [ $reason = "BOUND" ]; then
|
|
|
|
if [ ! -z "$new_ip_address" -a ! -z "$new_subnet_mask" ]; then
|
|
|
|
ip addr add dev $interface $new_ip_address/$new_subnet_mask
|
|
|
|
fi
|
|
|
|
if [ ! -z "$new_host_name" ]; then
|
|
|
|
hostname $new_host_name
|
2012-01-16 15:00:36 +00:00
|
|
|
lldptool -T -i $interface -V 5 enableTx=yes >& /dev/null
|
2011-07-14 17:03:00 +00:00
|
|
|
fi
|
|
|
|
if [ ! -z "$new_domain_name" ]; then
|
|
|
|
echo search $new_domain_name >> /etc/resolv.conf
|
|
|
|
fi
|
2011-07-14 17:10:08 +00:00
|
|
|
for ns in $new_domain_name_servers; do
|
2011-07-14 17:03:00 +00:00
|
|
|
echo nameserver $ns >> /etc/resolv.conf
|
|
|
|
done
|
|
|
|
for ntp in $new_ntp_servers; do
|
2011-07-19 15:00:21 +00:00
|
|
|
echo server $ntp iburst >> /etc/ntp.conf
|
2011-07-14 17:03:00 +00:00
|
|
|
done
|
|
|
|
for gw in $new_routers; do
|
|
|
|
ip route add default via $gw
|
|
|
|
done
|
2011-07-28 18:31:30 +00:00
|
|
|
if [ ! -z "$new_log_servers" ]; then
|
2011-07-28 17:18:10 +00:00
|
|
|
head -n -1 /etc/rsyslog.conf > /etc/rsyslog.conf.new
|
|
|
|
cp /etc/rsyslog.conf.new /etc/rsyslog.conf
|
2011-07-28 18:31:30 +00:00
|
|
|
fi
|
2011-07-28 17:18:10 +00:00
|
|
|
for ls in $new_log_servers; do
|
|
|
|
echo *.* @$ls >> /etc/rsyslog.conf
|
|
|
|
done
|
2011-07-28 18:31:30 +00:00
|
|
|
kill -1 `cat /var/run/syslogd.pid`
|
2011-07-28 17:18:10 +00:00
|
|
|
|
2011-07-19 15:00:21 +00:00
|
|
|
if [ ! -z "$new_tcode" -a -r "/usr/share/zoneinfo/posix/$new_tcode" ]; then
|
|
|
|
cp "/usr/share/zoneinfo/posix/$new_tcode" /etc/localtime
|
|
|
|
rm -rf /usr/share/zoneinfo #free up ramdisk
|
|
|
|
fi
|
2011-07-14 17:03:00 +00:00
|
|
|
elif [ $reason = "BOUND6" ]; then
|
|
|
|
if [ ! -z "$new_ip6_address" ]; then
|
|
|
|
ip addr add dev $interface $new_ip6_address/$new_ip6_prefixlen
|
|
|
|
fi
|
2011-09-12 13:48:06 +00:00
|
|
|
elif [ $reason = "RELEASE" ]; then
|
|
|
|
if [ ! -z "$old_ip_address" ]; then
|
|
|
|
ip addr del dev $interface $old_ip_address/$old_subnet_mask
|
|
|
|
fi
|
2011-09-16 22:55:25 +00:00
|
|
|
elif [ $reason = "RELEASE6" ]; then
|
|
|
|
if [ ! -z "$old_ip6_address" ]; then
|
|
|
|
ip addr del dev $interface $old_ip6_address/$old_ip6_prefixlen
|
|
|
|
fi
|
2011-07-14 17:03:00 +00:00
|
|
|
fi
|
2011-07-19 15:00:21 +00:00
|
|
|
exit 0
|