Release new version 0.20.1
[grml-autoconfig.git] / etc / dhcp / 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