1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 11_dhcphostname.dpatch by Andreas Thienemann <andreas@bawue.net>
3 ## and Michael Prokop <mika@grml.org>
5 ## All lines beginning with `## DP:' are a description of the patch.
6 ## DP: Support disabling setting hostname via DNS info
10 Support 'nodhcphostname' option which will disable setting the
11 hostname of the booted system according to the DNS information.
12 This patch takes care of the netboot case.
14 diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking
15 index 9554b77..9270e9c 100755
16 --- a/scripts/live-bottom/23networking
17 +++ b/scripts/live-bottom/23networking
18 @@ -135,6 +135,19 @@ ${rc_server1}
21 cat /root/etc/resolv.conf >> /root/var/log/netboot.config
23 + if [ -z "$NODHCPHOSTNAME" ]
25 + dhcp_address=$(cat netboot.config | awk '/address:/{print $2}')
26 + dhcp_hostname=$(busybox nslookup ${dhcp_address} ${rc_server0#nameserver }| awk \
27 + '/Address 1: '${dhcp_address}'/{ print $4 }')
29 + if [ -n "$dhcp_hostname" ]
31 + echo $dhcp_hostname > /root/etc/hostname
33 + unset dhcp_address dhcp_hostname dhcp_hostname
40 @@ -216,6 +216,11 @@ Arguments ()
41 export NOACCESSIBILITY
45 + NODHCPHOSTNAME="Yes"
46 + export NODHCPHOSTNAME