From: Stéphane Graber Date: Mon, 2 Dec 2013 22:42:48 +0000 (-0500) Subject: Some tweak on previous change (timezone) X-Git-Tag: lxc-1.0.0.beta1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a3673e80732ab83d807d406fb2fd3c3b7f54ad3;p=thirdparty%2Flxc.git Some tweak on previous change (timezone) 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 --- diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in index 0f0946a5a..4612b730a 100644 --- a/templates/lxc-debian.in +++ b/templates/lxc-debian.in @@ -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 diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in index e97c7e3a3..019ef5b03 100644 --- a/templates/lxc-ubuntu-cloud.in +++ b/templates/lxc-ubuntu-cloud.in @@ -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 diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index 8ed9be7cd..18cacf686 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -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