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>
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
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`