Use dhclient hooks instead of proprietary pump hooks for dhcphostname
[grml-autoconfig.git] / etc / dhcp3 / dhclient-exit-hooks.d / grml-sethostname
1 # only run the comamnd if we bound to a new ip
2 case "$reason" in BOUND)
3 if ! grep -q 'nodhcphostname' /proc/cmdline && [ -f /etc/grml_cd ] ; then
4
5     hostname=$(busybox nslookup "$new_ip_address" | awk '/Address 1: '$new_ip_address'/ {print $4}')
6     if [ -n "$hostname" ] ; then
7         grml-hostname "$hostname"
8         hostname -F /etc/hostname
9     fi
10 fi
11 ;;
12 esac