Add debian/patches/11_dhcphostname.patch
authorMichael Prokop <mika@grml.org>
Sat, 17 Oct 2009 14:45:29 +0000 (16:45 +0200)
committerMichael Prokop <mika@grml.org>
Sat, 17 Oct 2009 14:45:29 +0000 (16:45 +0200)
debian/changelog
debian/patches/00list
debian/patches/11_dhcphostname.patch [new file with mode: 0755]

index c1e2382..f160fb0 100644 (file)
@@ -1,3 +1,13 @@
+live-initramfs (1.157.3-1grml.01) unstable; urgency=low
+
+  * Add debian/patches/11_dhcphostname.patch (initial version by
+    Andreas Thienemann <andreas@bawue.net> - thanks!):
+    Support 'nodhcphostname' option which will disable setting the
+    hostname of the booted system according to the dns information.
+    This patch takes care of the netboot case.
+
+ -- Michael Prokop <mika@grml.org>  Sat, 17 Oct 2009 16:43:56 +0200
+
 live-initramfs (1.157.3-1grml.00) unstable; urgency=low
 
   * Synchronise with Debian's version 1.157.3-1.
index 0f38791..6fb2fe4 100644 (file)
@@ -8,3 +8,4 @@
 08_readonly_devices.dpatch
 09_fix_resolvconf_pxeboot.dpatch
 10_support_ethdevice.dpatch
+11_dhcphostname.patch
diff --git a/debian/patches/11_dhcphostname.patch b/debian/patches/11_dhcphostname.patch
new file mode 100755 (executable)
index 0000000..23d76ca
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 11_dhcphostname.dpatch by Andreas Thienemann <andreas@bawue.net>
+## and Michael Prokop <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Support disabling setting hostname via DNS info
+
+@DPATCH@
+
+Support 'nodhcphostname' option which will disable setting the
+hostname of the booted system according to the DNS information.
+This patch takes care of the netboot case.
+
+--- a/grml/23networking        2009-06-02 11:57:00.156614733 +0200
++++ b/grml/23networking        2009-06-02 12:00:04.623804092 +0200
+@@ -140,6 +140,19 @@ ${rc_server1}
+ EOF
+                       cat /root/etc/resolv.conf >> /root/var/log/netboot.config
++
++                      if [ -z "$NODHCPHOSTNAME" ]
++                      then
++                              dhcp_address=$(cat netboot.config | awk '/address:/{print $2}')
++                              dhcp_hostname=$(busybox nslookup ${dhcp_address} ${rc_server0#nameserver }| awk \
++                                      '/Address 1: '${dhcp_address}'/{ print $4 }')
++
++                              if [ -n "$dhcp_hostname" ]
++                              then
++                                      echo $dhcp_hostname > /root/etc/hostname
++                              fi
++                              unset dhcp_address dhcp_hostname dhcp_hostname
++                      fi
+               fi
+       fi
+ fi
+--- a/scripts/live
++++ b/scripts/live
+@@ -241,6 +241,11 @@ Arguments ()
+                               export NOCONSOLEKEYBOARD
+                               ;;
++                      nodhcphostname)
++                              NODHCPHOSTNAME="Yes"
++                              export NODHCPHOSTNAME
++                              ;;
++
+                       nofastboot)
+                               NOFASTBOOT="Yes"
+                               export NOFASTBOOT