From: "S.Çağlar Onur" <cag...@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@qgq:~/Project/lxc/examples$ sudo /usr/bin/lxc-create -n test
lxc-create: no configuration path defined

Signed-off-by: S.Çağlar Onur <cag...@10ur.org>
---
 .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&reg; 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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to