- local f = io.popen('uname -m', 'r')
- local target = f:read('*a')
- f:close()
- target = target:gsub("^%s*(.-)%s*$", "%1")
-
- local lxc_dist = lxc_template:gsub("(.*):(.*)", '%1')
- local lxc_release = lxc_template:gsub("(.*):(.*)", '%2')
-
- local data = conn:call("lxc", "create", { name = lxc_name, template = "download", args = { "--server", url, "--no-validate", "--dist", lxc_dist, "--release", lxc_release, "--arch", target } } )
-
- luci.http.write(data)
+ local lxc_dist, lxc_release = lxc_template:match("^(.+):(.+)$")
+
+ luci.http.write(util.ubus("lxc", "create", {
+ name = lxc_name,
+ template = "download",
+ args = {
+ "--server", uci:get("lxc", "lxc", "url"),
+ "--no-validate",
+ "--dist", lxc_dist,
+ "--release", lxc_release,
+ "--arch", lxc_get_arch_target()
+ }
+ }))