[lxc-devel] [PATCH] lxc-create: Allow for empty or unset template name
Serge Hallyn
serge.hallyn at canonical.com
Fri Dec 7 17:22:34 UTC 2012
Quoting Stéphane Graber (stgraber at ubuntu.com):
> This restores an old behaviour where lxc-create can be called without
> a template. In such case, only a minimal configuration is built and no
> rootfs is created. However the various backingstore code is still used.
>
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/lxc/lxc-create.in | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
> index 3c66bfa..5cd9fdb 100644
> --- a/src/lxc/lxc-create.in
> +++ b/src/lxc/lxc-create.in
> @@ -284,19 +284,19 @@ if [ ! -r "$lxc_config" ]; then
> exit 1
> fi
>
> -# Allow for a path to be provided as the template name
> -if [ -x "$lxc_template" ]; then
> - template_path=$lxc_template
> -else
> - template_path=${templatedir}/lxc-$lxc_template
> -fi
> +if [ ! -z "$lxc_template" ]; then
or '-n' ? :)
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> + # Allow for a path to be provided as the template name
> + if [ -x "$lxc_template" ]; then
> + template_path=$lxc_template
> + else
> + template_path=${templatedir}/lxc-$lxc_template
> + fi
>
> -if ! [ -x "$template_path" ]; then
> - echo "$(basename $0): unknown template '$lxc_template'" >&2
> - cleanup
> -fi
> + if ! [ -x "$template_path" ]; then
> + echo "$(basename $0): unknown template '$lxc_template'" >&2
> + cleanup
> + fi
>
> -if [ ! -z "$lxc_template" ]; then
> sum=$(sha1sum $template_path | cut -d ' ' -f1)
> echo "# Template used to create this container: $lxc_template" >> $lxc_path/$lxc_name/config
> if [ -n "$*" ]; then
> --
> 1.8.0
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
More information about the lxc-devel
mailing list