summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/controller/admin
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2018-08-17 12:52:36 +0200
committerDirk Brenken <dev@brenken.org>2018-08-17 12:52:36 +0200
commit89486bd66f828e272a1456b0ccd6e18617ae5ff0 (patch)
treed7240193be77b6cfe433200033da11b1e4706d74 /modules/luci-mod-admin-full/luasrc/controller/admin
parent8c77975d1bfc9f79580b83f5b5e591b8b4cae67f (diff)
luci-mod-admin-full: allow forced upgrade (revised)
* allow 'forced' firmware upgrades, even if the image format check fails. Useful where flashing back to the OEM versions or switching between ar71xx and ath79 builds * option is only visible after first/failed image check * added warning info (see screenshots below) Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/controller/admin')
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/system.lua14
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