From 33f3de4eaaa4e2084ea6e3695e29da5b736f1095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 29 Aug 2012 13:51:37 -0700 Subject: [PATCH] Don't update the host-name field in dhclient.conf when not hardcoded. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Debian and Ubuntu, the default host-name field in dhclient.conf is set to either "" or "gethostname()" both of which get replaced by the machine's hostname at query time. The sed call currently present in lxc-clone hardcodes the hostname in dhclient.conf, causing dpkg to prompt on isc-dhcp updates. Signed-off-by: Stéphane Graber --- src/lxc/lxc-clone.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in index d9ed78c42..c373861fc 100644 --- a/src/lxc/lxc-clone.in +++ b/src/lxc/lxc-clone.in @@ -265,7 +265,7 @@ fi echo "Updating rootfs..." # so you can 'ssh $hostname.' or 'ssh $hostname.local' -if [ -f $rootfs/etc/dhcp/dhclient.conf ]; then +if [ -f $rootfs/etc/dhcp/dhclient.conf ] && ! grep -q "^send host-name.*hostname" $rootfs/etc/dhcp/dhclient.conf; then sed -i "s/send host-name.*$/send host-name \"$hostname\";/" $rootfs/etc/dhcp/dhclient.conf fi