]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-debian: Make timezone match the host
authorfunditus <funditus@mail.ru>
Mon, 25 Nov 2013 15:03:43 +0000 (21:03 +0600)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 2 Dec 2013 22:39:25 +0000 (17:39 -0500)
Set timezone in container as on the host

Signed-off-by: funditus <funditus@mail.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-debian.in

index cd69cebe8ce5b7df218eb7a5c5e523a028e24b50..0f0946a5a5cb244bc9354c7739745aab70edbfc9 100644 (file)
@@ -93,6 +93,18 @@ EOF
     chroot $rootfs /usr/sbin/update-rc.d -f hwclock.sh remove
     chroot $rootfs /usr/sbin/update-rc.d -f hwclockfirst.sh remove
 
+    # set initial timezone as on host
+    if [ -f /etc/timezone ]; then
+        echo $(cat /etc/timezone) > $rootfs/etc/timezone
+        chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
+    elif [ -f /etc/sysconfig/clock ]; then
+        source /etc/sysconfig/clock
+        echo $ZONE > $rootfs/etc/timezone
+        chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
+    else
+        echo "Timezone in container is not configured. Adjust it manually."
+    fi
+
     echo "root:root" | chroot $rootfs chpasswd
     echo "Root password is 'root', please change !"