diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2016-08-19 10:59:52 +0300 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2016-08-19 11:08:24 +0300 |
commit | c0af3601fb87e6c695d07f0af1fbec8dcfdb2f71 (patch) | |
tree | acc315969a3bcfc9ad28a5fe9dafa29989de30b4 /modules/luci-mod-admin-full/luasrc | |
parent | 19981732fc50073a80cca29d430005a11426c706 (diff) |
luci-mod-admin-full: show also sha256 checksum for sysupgrade images
Show also the sha256 checksum in addition to MD5 checksum to enable
image verification also for builds with only sha256 checksums.
If the 'sha256sum' command is not present in the system, the value
remains empty.
Note: The easiest way to get the 'sha256sum' command is to compile it
into busybox.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc')
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/controller/admin/system.lua | 5 | ||||
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm | 3 |
2 files changed, 7 insertions, 1 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 fd6dda1c8..cf8cfb5d2 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua @@ -185,6 +185,10 @@ local function image_checksum(image) return (luci.sys.exec("md5sum %q" % image):match("^([^%s]+)")) end +local function image_sha256_checksum(image) + return (luci.sys.exec("sha256sum %q" % image):match("^([^%s]+)")) +end + local function supports_sysupgrade() return nixio.fs.access("/lib/upgrade/platform.sh") end @@ -268,6 +272,7 @@ function action_sysupgrade() if image_supported(image_tmp) 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")) diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm index 5ca0398e1..279af575c 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm @@ -24,7 +24,8 @@ <fieldset class="cbi-section"> <ul> - <li><%:Checksum%>: <code><%=checksum%></code></li> + <li><%:Checksum MD5%>: <code><%=checksum%></code></li> + <li><%:Checksum SHA256%>: <code><%=sha256ch%></code></li> <li><%:Size%>: <% local w = require "luci.tools.webadmin" write(w.byte_format(size)) |