1
Description: Don't update the host-name field in dhclient.conf when
2
it doesn't contain an hardcoded value.
4
On Debian and Ubuntu, the default host-name field in dhclient.conf is
5
set to either "<hostname>" or "gethostname()" both of which get replaced
6
by the machine's hostname at query time.
8
The sed call currently present in lxc-clone hardcodes the hostname in
9
dhclient.conf, causing dpkg to prompt on isc-dhcp updates.
11
Author: Stéphane Graber <stgraber@ubuntu.com>
12
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1017862
15
--- lxc-0.8.0~rc1.orig/src/lxc/lxc-clone.in
16
+++ lxc-0.8.0~rc1/src/lxc/lxc-clone.in
17
@@ -263,7 +263,7 @@ fi
18
echo "Updating rootfs..."
20
# so you can 'ssh $hostname.' or 'ssh $hostname.local'
21
-if [ -f $rootfs/etc/dhcp/dhclient.conf ]; then
22
+if [ -f $rootfs/etc/dhcp/dhclient.conf ] && ! grep -q "^send host-name.*hostname" $rootfs/etc/dhcp/dhclient.conf; then
23
sed -i "s/send host-name.*$/send host-name \"$hostname\";/" $rootfs/etc/dhcp/dhclient.conf