]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Some tweak on previous change (timezone)
authorStéphane Graber <stgraber@ubuntu.com>
Mon, 2 Dec 2013 22:42:48 +0000 (17:42 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 2 Dec 2013 22:42:48 +0000 (17:42 -0500)
This adds the same code to the Debian-based templates (Ubuntu and Ubuntu
Cloud) and also avoids a needless fork.

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

index 0f0946a5a5cb244bc9354c7739745aab70edbfc9..4612b730a9ea21d85d13e635c2bf6ed25a692c62 100644 (file)
@@ -95,7 +95,7 @@ EOF
 
     # set initial timezone as on host
     if [ -f /etc/timezone ]; then
-        echo $(cat /etc/timezone) > $rootfs/etc/timezone
+        cat /etc/timezone > $rootfs/etc/timezone
         chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
     elif [ -f /etc/sysconfig/clock ]; then
         source /etc/sysconfig/clock
index e97c7e3a3a07228bd537f1b33ae711aaecb5718b..019ef5b0395093c591f5455f3794be8a203be006 100644 (file)
@@ -135,6 +135,18 @@ EOF
         done
     fi
 
+    # Set initial timezone as on host
+    if [ -f /etc/timezone ]; then
+        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
+
     # rmdir /dev/shm for containers that have /run/shm
     # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
     # get bind mounted to the host's /run/shm.  So try to rmdir
index 8ed9be7cd0da851b85ca1d59c93726e31ed92d39..18cacf686b81cab6cf5ff172acde71562df8c8be 100644 (file)
@@ -537,6 +537,18 @@ EOF
         install_packages $rootfs $packages
     fi
 
+    # Set initial timezone as on host
+    if [ -f /etc/timezone ]; then
+        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
+
     # rmdir /dev/shm for containers that have /run/shm
     # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
     # get bind mounted to the host's /run/shm.  So try to rmdir