From: Brett Parker <iDunno@sommitrealweird.co.uk>
Date: Sat, 21 May 2016 22:30:02 +0000 (+0100)
Subject: Set the hostname to the name of the container
X-Git-Url: https://git.sommitrealweird.co.uk/lxc-debian-unprivileged.git/commitdiff_plain/4af5c17fb1da5c3d6fbbd2d13174326e04147610

Set the hostname to the name of the container
---

diff --git a/templates/lxc-debian-unprivileged b/templates/lxc-debian-unprivileged
index bc6288b..3311609 100755
--- a/templates/lxc-debian-unprivileged
+++ b/templates/lxc-debian-unprivileged
@@ -191,6 +191,9 @@ fi
 # remove some interesting breakages in pam for unpriv foo
 sed -i -e 's#^\(session.*required.*pam_loginuid.so\)#\#\1#;' ${LXC_ROOTFS}/etc/pam.d/*
 
+# set the hostname
+echo $LXC_NAME > ${LXC_ROOTFS}/etc/hostname
+
 # setup sources.list
 cat <<EOF > ${LXC_ROOTFS}/etc/apt/sources.list
 deb $DEBIAN_MIRROR $DEBIAN_RELEASE main