Drop deprecated /etc/dhcp3 and ship as /etc/dhcp only
[grml-autoconfig.git] / etc / dhcp / dhclient-exit-hooks.d / grml-sethostname
deleted file mode 120000 (symlink)
index 36cd991c5836e5383fead4a4705cc6471ad4e9f3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../../dhcp3/dhclient-exit-hooks.d/grml-sethostname
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..acd03a2913672183e05664a82dd5a03c2dc239c2
--- /dev/null
@@ -0,0 +1,12 @@
+# only run the comamnd if we bound to a new ip
+case "$reason" in BOUND)
+if ! grep -q 'nodhcphostname' /proc/cmdline && [ -f /etc/grml_cd ] ; then
+
+    hostname=$(busybox nslookup "$new_ip_address" | awk '/Address 1: '$new_ip_address'/ {print $4}')
+    if [ -n "$hostname" ] ; then
+        grml-hostname "$hostname"
+        hostname -F /etc/hostname
+    fi
+fi
+;;
+esac