xcat-core/xCAT-nbroot2/dhclient-script
jbjohnso 777176fea6 Switch nbroot2 to bash (at size cost, but so many scripts fail in dash)
Implement DHCP driven TZ database (with TZ space reclaimed after assignment)
Fix DHCP on multpile nics (dhclient must have per-interface pid files, sharing a leases is ok though)


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10120 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2011-07-19 15:00:21 +00:00

38 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
if [ $reason = "PREINIT" -o $reason = "PREINIT6" ]; then
ip link set $interface up
while ! (ip link show $interface|grep LOWER_UP > /dev/null 2>&1); do
sleep 0.1
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
lldptool -T -i $interface -V 5 enableTx=yes
fi
if [ ! -z "$new_domain_name" ]; then
echo search $new_domain_name >> /etc/resolv.conf
fi
for ns in $new_domain_name_servers; do
echo nameserver $ns >> /etc/resolv.conf
done
for ntp in $new_ntp_servers; do
echo server $ntp iburst >> /etc/ntp.conf
done
for gw in $new_routers; do
ip route add default via $gw
done
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
elif [ $reason = "BOUND6" ]; then
if [ ! -z "$new_ip6_address" ]; then
ip addr add dev $interface $new_ip6_address/$new_ip6_prefixlen
fi
fi
exit 0