luci-app-lxc: Allow versioned images
authorMichal Hrusecky <michal.hrusecky@nic.cz>
Thu, 16 Jun 2016 08:44:23 +0000 (10:44 +0200)
committerMichal Hrusecky <michal.hrusecky@nic.cz>
Thu, 16 Jun 2016 08:44:23 +0000 (10:44 +0200)
I makes quite some sense to provide user the choice between various versions of
the distribution to install into LXC.

Signed-off-by: Michal Hrusecky <michal.hrusecky@nic.cz>
utils/luci-app-lxc/files/controller/lxc.lua
utils/luci-app-lxc/files/view/lxc.htm

index f3f5d07ba78da9d20792add2f79b225608df5854..6c28d4159f903cde64c4f7bff3f21b7ed14d856a 100644 (file)
@@ -80,7 +80,10 @@ function lxc_create(lxc_name, lxc_template)
 
        local target = _G.DISTRIB_TARGET:match('([^/]+)')
 
-       local data = conn:call("lxc", "create", { name = lxc_name, template = "download", args = { "--server", url,  "--no-validate", "--dist", lxc_template, "--release", "bb", "--arch", target } } )
+       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)
 end
index 1376968e3b7f4b6474c4f68c4a8a614753b490b9..db216fc28ef56bea2f3b9adb0298ea60d65df4ff 100644 (file)
@@ -47,7 +47,7 @@ Author: Petar Koretic <petar.koretic@sartura.hr>
                                </td>
                                <td>
                                        <select id="s_template" class="cbi-input-select cbi-button">
-                                               <option value="openwrt">OpenWrt</option>
+                                               <option value="openwrt:bb">OpenWrt BB</option>
                                        </select>
                                </td>
                                <td>