[lxc-devel] [PATCH 2/4] Set timezone for new container if not previously defined.

Stéphane Graber stgraber at ubuntu.com
Sun Mar 23 00:54:34 UTC 2014


On Sat, Mar 22, 2014 at 01:57:36PM -0400, Michael H. Warfield wrote:
> Set timezone for new container if not previously defined.
> 
> 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 at WittsEnd.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  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 55e0531..f11a98c 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 fa89121..f32ca53 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
> -- 
> 1.8.3.1
> 
> 
> -- 
> Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
>    /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
>    NIC whois: MHW9          | An optimist believes we live in the best of all
>  PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
> 



> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140322/98715a09/attachment.pgp>


More information about the lxc-devel mailing list