summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-lxc/luasrc
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2018-07-01 19:59:52 +0200
committerDirk Brenken <dev@brenken.org>2018-07-01 19:59:52 +0200
commit1f2d40b5047bc88ea557ccecccecf27570194d1b (patch)
treeaa5cd57950aa789381833b5445748ebe0c3163ef /applications/luci-app-lxc/luasrc
parentb198de11bc1501f1a75dff9f5fb01f927f902186 (diff)
luci-app-lxc: add backingstore support
* second try to enable backingstore support, untested (see #1919) Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-lxc/luasrc')
-rw-r--r--applications/luci-app-lxc/luasrc/controller/lxc.lua21
1 files changed, 6 insertions, 15 deletions
diff --git a/applications/luci-app-lxc/luasrc/controller/lxc.lua b/applications/luci-app-lxc/luasrc/controller/lxc.lua
index dcba51bf7..4a7f96e5f 100644
--- a/applications/luci-app-lxc/luasrc/controller/lxc.lua
+++ b/applications/luci-app-lxc/luasrc/controller/lxc.lua
@@ -19,7 +19,7 @@ module("luci.controller.lxc", package.seeall)
local uci = require "luci.model.uci".cursor()
local util = require "luci.util"
local nx = require "nixio"
-local url = uci:get("lxc", "lxc", "url")
+local url = util.shellquote(uci:get("lxc", "lxc", "url"))
function index()
if not nixio.fs.access("/etc/config/lxc") then
@@ -44,7 +44,7 @@ function lxc_get_downloadable()
local templates = {}
local f = io.popen('sh /usr/share/lxc/templates/lxc-download --list %s --server %s 2>/dev/null'
- %{ ssl_status, util.shellquote(url) }, 'r')
+ %{ ssl_status, url }, 'r')
local line
for line in f:lines() do
local dist, version, dist_target = line:match("^(%S+)%s+(%S+)%s+(%S+)%s+default%s+%S+$")
@@ -60,30 +60,21 @@ end
function lxc_create(lxc_name, lxc_template)
luci.http.prepare_content("text/plain")
-
local path = lxc_get_config_path()
if not path then
return
end
- local src_err
local ssl_status = lxc_get_ssl_status()
local lxc_dist, lxc_release = lxc_template:match("^(.+):(.+)$")
- luci.http.write(util.ubus("lxc", "create", {
- name = lxc_name,
- template = "download",
- args = {
- "--server", url,
- "--dist", lxc_dist,
- "--release", lxc_release,
- "--arch", lxc_get_arch_target(url),
- ssl_status
- }
- }), src_err)
+ luci.sys.call('/usr/bin/lxc-create --quiet --name %s --bdev best --template download -- --dist %s --release %s --arch %s --server %s %s'
+ %{ lxc_name, lxc_dist, lxc_release, lxc_get_arch_target(url), url, ssl_status })
while (nx.fs.access(path .. lxc_name .. "/partial")) do
nx.nanosleep(1)
end
+
+ luci.http.write("0")
end
function lxc_action(lxc_action, lxc_name)