commit 3fffe7e1ffd6615b84a081577f57660db5d804eb
parent 237d312cdbd11de7c21f485a9d26bbacf9259886
Author: Luka Perkov <luka.perkov@sartura.hr>
Date: Thu, 16 Jun 2016 15:59:40 +0200
Merge pull request #2742 from miska/master
lxc: Use more FSH compliant /srv/lxc instead of new root dir
Diffstat:
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/utils/luci-app-lxc/files/controller/lxc.lua b/utils/luci-app-lxc/files/controller/lxc.lua
@@ -93,10 +93,22 @@ function lxc_action(lxc_action, lxc_name)
luci.http.write_json(ec and {} or data)
end
+function lxc_get_config_path()
+ local f = io.open("/etc/lxc/lxc.conf", "r")
+ local content = f:read("*all")
+ f:close()
+ local ret = content:match('^%s*lxc.lxcpath%s*=%s*([^%s]*)')
+ if ret then
+ return ret .. "/"
+ else
+ return "/srv/lxc/"
+ end
+end
+
function lxc_configuration_get(lxc_name)
luci.http.prepare_content("text/plain")
- local f = io.open("/lxc/" .. lxc_name .. "/config", "r")
+ local f = io.open(lxc_get_config_path() .. lxc_name .. "/config", "r")
local content = f:read("*all")
f:close()
@@ -112,7 +124,7 @@ function lxc_configuration_set(lxc_name)
return luci.http.write("1")
end
- local f, err = io.open("/lxc/" .. lxc_name .. "/config","w+")
+ local f, err = io.open(lxc_get_config_path() .. lxc_name .. "/config","w+")
if not f then
return luci.http.write("2")
end
diff --git a/utils/lxc/Makefile b/utils/lxc/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=lxc
PKG_VERSION:=1.1.5
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_LICENSE:=LGPL-2.1+ BSD-2-Clause GPL-2.0
PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
@@ -199,7 +199,7 @@ define Package/lxc-common/install
./files/lxc.conf \
$(1)/etc/lxc/lxc.conf
- $(INSTALL_DIR) $(1)/lxc/
+ $(INSTALL_DIR) $(1)/srv/lxc/
endef
define Package/lxc-hooks/install
diff --git a/utils/lxc/files/lxc.conf b/utils/lxc/files/lxc.conf
@@ -1 +1 @@
-lxc.lxcpath = /lxc
+lxc.lxcpath = /srv/lxc