Update changelog.
[live-initramfs-grml.git] / debian / patches / 11_dhcphostname.patch
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>
4 ##
5 ## All lines beginning with `## DP:' are a description of the patch.
6 ## DP: Support disabling setting hostname via DNS info
7
8 @DPATCH@
9
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.
13
14 --- a/grml/23networking 2009-06-02 11:57:00.156614733 +0200
15 +++ b/grml/23networking 2009-06-02 12:00:04.623804092 +0200
16 @@ -140,6 +140,19 @@ ${rc_server1}
17  EOF
18  
19                         cat /root/etc/resolv.conf >> /root/var/log/netboot.config
20 +
21 +                       if [ -z "$NODHCPHOSTNAME" ]
22 +                       then
23 +                               dhcp_address=$(cat netboot.config | awk '/address:/{print $2}')
24 +                               dhcp_hostname=$(busybox nslookup ${dhcp_address} ${rc_server0#nameserver }| awk \
25 +                                       '/Address 1: '${dhcp_address}'/{ print $4 }')
26 +
27 +                               if [ -n "$dhcp_hostname" ]
28 +                               then
29 +                                       echo $dhcp_hostname > /root/etc/hostname
30 +                               fi
31 +                               unset dhcp_address dhcp_hostname dhcp_hostname
32 +                       fi
33                 fi
34         fi
35  fi
36 --- a/scripts/live
37 +++ b/scripts/live
38 @@ -241,6 +241,11 @@ Arguments ()
39                                 export NOCONSOLEKEYBOARD
40                                 ;;
41  
42 +                       nodhcphostname)
43 +                               NODHCPHOSTNAME="Yes"
44 +                               export NODHCPHOSTNAME
45 +                               ;;
46 +
47                         nofastboot)
48                                 NOFASTBOOT="Yes"
49                                 export NOFASTBOOT