diff options
author | Dirk Brenken <dev@brenken.org> | 2018-08-17 16:11:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-17 16:11:27 +0200 |
commit | 6fa126755329c0d4c0d80c51f1b16ccf16c272e3 (patch) | |
tree | d7240193be77b6cfe433200033da11b1e4706d74 /modules/luci-mod-admin-full/luasrc/controller | |
parent | 8c77975d1bfc9f79580b83f5b5e591b8b4cae67f (diff) | |
parent | 89486bd66f828e272a1456b0ccd6e18617ae5ff0 (diff) |
Merge pull request #2075 from dibdot/force_update
luci-mod-admin-full: allow forced upgrade (revised)
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/controller')
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/controller/admin/system.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua index 153615b58a..b278b21878 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua @@ -269,15 +269,17 @@ function action_sysupgrade() -- -- Initiate firmware flash -- - local step = tonumber(http.formvalue("step") or 1) + local step = tonumber(http.formvalue("step")) or 1 if step == 1 then - if image_supported(image_tmp) then + local force = http.formvalue("force") + if image_supported(image_tmp) or force then luci.template.render("admin_system/upgrade", { checksum = image_checksum(image_tmp), sha256ch = image_sha256_checksum(image_tmp), storage = storage_size(), size = (fs.stat(image_tmp, "size") or 0), - keep = (not not http.formvalue("keep")) + keep = (not not http.formvalue("keep")), + force = (not not http.formvalue("force")) }) else fs.unlink(image_tmp) @@ -287,17 +289,19 @@ function action_sysupgrade() image_invalid = true }) end + -- -- Start sysupgrade flash -- elseif step == 2 then local keep = (http.formvalue("keep") == "1") and "" or "-n" + local force = (http.formvalue("force") == "1") and "" or "-F" luci.template.render("admin_system/applyreboot", { title = luci.i18n.translate("Flashing..."), msg = luci.i18n.translate("The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings."), - addr = (#keep > 0) and "192.168.1.1" or nil + addr = (#keep > 0) and (#force > 0) and "192.168.1.1" or nil }) - fork_exec("sleep 1; killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %q" %{ keep, image_tmp }) + fork_exec("sleep 1; killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %s %q" %{ keep, force, image_tmp }) end end |