Commit 6b5d5b97 by S.Çağlar Onur Committed by Stéphane Graber

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 avatarS.Çağlar Onur <caglar@10ur.org> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 4bc8b185
...@@ -47,6 +47,7 @@ src/lxc/lxc-create ...@@ -47,6 +47,7 @@ src/lxc/lxc-create
src/lxc/lxc-destroy src/lxc/lxc-destroy
src/lxc/lxc-execute src/lxc/lxc-execute
src/lxc/lxc-freeze src/lxc/lxc-freeze
src/lxc/lxc.functions
src/lxc/lxc-info src/lxc/lxc-info
src/lxc/lxc-init src/lxc/lxc-init
src/lxc/lxc-kill src/lxc/lxc-kill
......
...@@ -26,8 +26,12 @@ templatedir=@LXCTEMPLATEDIR@ ...@@ -26,8 +26,12 @@ templatedir=@LXCTEMPLATEDIR@
lxcinitdir=@LXCINITDIR@ lxcinitdir=@LXCINITDIR@
get_default_lxcpath() { get_default_lxcpath() {
(grep -v "^#" "$globalconf" 2>/dev/null || echo "lxcpath=@LXCPATH@") | \ LXC_PATH=$(grep -v "^#" "$globalconf" 2>/dev/null | grep "[ \t]*lxcpath[ \t]*=")
grep "[ \t]*lxcpath[ \t]*=" | awk -F= '{ print $2 }' if [ -n "$LXC_PATH" ]; then
echo $LXC_PATH | awk -F= '{ print $2 }'
else
echo @LXCPATH@
fi
} }
lxc_path=`get_default_lxcpath` lxc_path=`get_default_lxcpath`
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment