[lxc-devel] [PATCH] Make lxc.functions return the default lxcpath if /etc/lxc/lxc.conf doesn't provide one
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Apr 1 04:07:07 UTC 2013
Quoting S.Çağlar Onur (caglar at 10ur.org):
> From: "S.Çağlar Onur" <caglar at 10ur.org>
>
> Currently it returns the default path only if /etc/lxc/lxc.conf missing.
> Since default lxc.conf doesn't contain lxcpath variable (this is at least the case in ubuntu) all tools fails if one doesn't give -P
>
> caglar at qgq:~/Project/lxc/examples$ sudo /usr/bin/lxc-create -n test
> lxc-create: no configuration path defined
>
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
Yeah I seem to have missed a step there.
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> .gitignore | 1 +
> src/lxc/lxc.functions.in | 8 ++++++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index b54ce3d..6bf0348 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -47,6 +47,7 @@ src/lxc/lxc-create
> src/lxc/lxc-destroy
> src/lxc/lxc-execute
> src/lxc/lxc-freeze
> +src/lxc/lxc.functions
> src/lxc/lxc-info
> src/lxc/lxc-init
> src/lxc/lxc-kill
> diff --git a/src/lxc/lxc.functions.in b/src/lxc/lxc.functions.in
> index ffc841a..82ef23c 100644
> --- a/src/lxc/lxc.functions.in
> +++ b/src/lxc/lxc.functions.in
> @@ -26,8 +26,12 @@ templatedir=@LXCTEMPLATEDIR@
> lxcinitdir=@LXCINITDIR@
>
> get_default_lxcpath() {
> - (grep -v "^#" "$globalconf" 2>/dev/null || echo "lxcpath=@LXCPATH@") | \
> - grep "[ \t]*lxcpath[ \t]*=" | awk -F= '{ print $2 }'
> + LXC_PATH=$(grep -v "^#" "$globalconf" 2>/dev/null | grep "[ \t]*lxcpath[ \t]*=")
> + if [ -n "$LXC_PATH" ]; then
> + echo $LXC_PATH | awk -F= '{ print $2 }'
> + else
> + echo @LXCPATH@
> + fi
> }
>
> lxc_path=`get_default_lxcpath`
> --
> 1.7.10.4
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel® Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. $5K grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> 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