From f5067ecbcc1e97052c33269b4afa6375073a91a1 Mon Sep 17 00:00:00 2001 From: "Michael H. Warfield" Date: Sat, 22 Mar 2014 13:57:36 -0400 Subject: [PATCH] Set timezone for new container if not previously defined. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If the container does not already contain an /etc/localtime timezone definition, then copy a definition from the host to the container. This is often a symlink to an appropriate system timezone definition files and is presumed to exist in Signed-off-by: Michael H. Warfield Acked-by: Stéphane Graber --- templates/lxc-centos.in | 7 +++++++ templates/lxc-fedora.in | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in index 55e053137..f11a98cc3 100644 --- a/templates/lxc-centos.in +++ b/templates/lxc-centos.in @@ -203,6 +203,13 @@ configure_centos() ) fi + # Set default localtime to the host localtime if not set... + if [ -e /etc/localtime -a ! -e ${rootfs_path}/etc/localtime ] + then + # if /etc/localtime is a symlink, this should preserve it. + cp -a /etc/localtime ${rootfs_path}/etc/localtime + fi + # Deal with some dain bramage in the /etc/init.d/halt script. # Trim it and make it our own and link it in before the default # halt script so we can intercept it. This also preventions package diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index fa891212a..f32ca5343 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -176,6 +176,13 @@ configure_fedora() ) fi + # Set default localtime to the host localtime if not set... + if [ -e /etc/localtime -a ! -e ${rootfs_path}/etc/localtime ] + then + # if /etc/localtime is a symlink, this should preserve it. + cp -a /etc/localtime ${rootfs_path}/etc/localtime + fi + # Deal with some dain bramage in the /etc/init.d/halt script. # Trim it and make it our own and link it in before the default # halt script so we can intercept it. This also preventions package -- 2.47.2