~serge-hallyn/ubuntu/quantal/lxc/lxc-fixapi

« back to all changes in this revision

Viewing changes to debian/patches/0092-clone-no-dhclient.conf-update-when-not-hardcoded

  • Committer: Stéphane Graber
  • Date: 2012-07-03 21:57:48 UTC
  • Revision ID: stgraber@ubuntu.com-20120703215748-89mxnzvy3kaexbn3
Tags: 0.8.0~rc1-4ubuntu18
releasing version 0.8.0~rc1-4ubuntu18

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Don't update the host-name field in dhclient.conf when
 
2
 it doesn't contain an hardcoded value.
 
3
 
 
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.
 
7
 
 
8
 The sed call currently present in lxc-clone hardcodes the hostname in
 
9
 dhclient.conf, causing dpkg to prompt on isc-dhcp updates.
 
10
 
 
11
Author: Stéphane Graber <stgraber@ubuntu.com>
 
12
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1017862
 
13
Forwarded: no
 
14
 
 
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..."
 
19
 
 
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
 
24
 fi
 
25