Commit 33f3de4e by Stéphane Graber

Don't update the host-name field in dhclient.conf when not hardcoded.

On Debian and Ubuntu, the default host-name field in dhclient.conf is set to either "<hostname>" 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: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent e470cba0
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment