]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Set timezone for new container if not previously defined.
authorMichael H. Warfield <mhw@WittsEnd.com>
Sat, 22 Mar 2014 17:57:36 +0000 (13:57 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 23 Mar 2014 00:57:57 +0000 (20:57 -0400)
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 <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-centos.in
templates/lxc-fedora.in

index 55e053137af9040b69804e28c07fd723895f49c8..f11a98cc3ffde98580840680a90424a8b902e576 100644 (file)
@@ -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
index fa891212a666b37a3b8286272f88f27c92c448ad..f32ca5343ebdeccb485453b025aab254484c385b 100644 (file)
@@ -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