From: S.Çağlar Onur Date: Mon, 1 Apr 2013 03:37:09 +0000 (-0400) Subject: Make lxc.functions return the default lxcpath if /etc/lxc/lxc.conf doesn't provide one X-Git-Tag: lxc-0.9.0~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b5d5b974d447cf00ebfbdd3a0574463d849f943;p=thirdparty%2Flxc.git Make lxc.functions return the default lxcpath if /etc/lxc/lxc.conf doesn't provide one 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@qgq:~/Project/lxc/examples$ sudo /usr/bin/lxc-create -n test lxc-create: no configuration path defined Signed-off-by: S.Çağlar Onur Acked-by: Serge E. Hallyn --- diff --git a/.gitignore b/.gitignore index b54ce3d3c..6bf0348f7 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 ffc841ad9..b41f9b899 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`