]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Make lxc.functions return the default lxcpath if /etc/lxc/lxc.conf doesn't provide one
authorS.Çağlar Onur <caglar@10ur.org>
Mon, 1 Apr 2013 03:37:09 +0000 (23:37 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 1 Apr 2013 14:12:56 +0000 (10:12 -0400)
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 <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
.gitignore
src/lxc/lxc.functions.in

index b54ce3d3cd6e0e3659bf205494a484e7ad1a125e..6bf0348f75d16c7c2f1af9369061cb1b7b5bd0ea 100644 (file)
@@ -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
index ffc841ad96d7f77f5c9a935d0b18ea2b2320fa41..b41f9b899ccfce3baea381725542fd751f82d567 100644 (file)
@@ -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`