Revert "Redesigned firmware upgrade process"
[project/luci.git] / modules / admin-mini / luasrc / controller / mini / system.lua
index d68283cc620a51b2170e5795f9ffe5e6fad21066..6d16ef8650e22c91e7ea1616f20384f8ccb5d4dd 100644 (file)
@@ -79,7 +79,7 @@ end
 function action_upgrade()
        require("luci.model.uci")
 
-       local ret, err
+       local ret  = nil
        local plat = luci.fs.mtime("/lib/upgrade/platform.sh")
        local tmpfile = "/tmp/firmware.img"
        local broadcom = os.execute('grep brcm_ /lib/upgrade/platform.sh >/dev/null 2>&1') == 0
@@ -105,11 +105,12 @@ function action_upgrade()
        local keepcfg = keep_avail and luci.http.formvalue("keepcfg")
 
        if plat and fname then
-               ret, err = luci.sys.flash(tmpfile, keepcfg and _keep_pattern())
+               ret = function()
+                       return luci.sys.flash(tmpfile, keepcfg and _keep_pattern())
+               end
        end
 
-       luci.template.render("admin_system/upgrade", {sysupgrade=plat,
-               ret=ret, err=err, keep_avail=keep_avail})
+       luci.template.render("mini/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail})
 end
 
 function _keep_pattern()