From fade8edd2dfe39ae579256d04220aba9da2ff074 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 12 Sep 2008 11:53:08 +0000 Subject: Redesigned firmware upgrade process --- modules/admin-full/luasrc/controller/admin/system.lua | 9 ++++----- .../admin-full/luasrc/view/admin_system/upgrade.htm | 18 ++++++------------ 2 files changed, 10 insertions(+), 17 deletions(-) (limited to 'modules/admin-full') diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 5d64336e0..55087a017 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -182,7 +182,7 @@ end function action_upgrade() require("luci.model.uci") - local ret + local ret, err 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 @@ -208,12 +208,11 @@ function action_upgrade() local keepcfg = keep_avail and luci.http.formvalue("keepcfg") if plat and fname then - ret = function() - return luci.sys.flash(tmpfile, keepcfg and _keep_pattern()) - end + ret, err = luci.sys.flash(tmpfile, keepcfg and _keep_pattern()) end - luci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) + luci.template.render("admin_system/upgrade", {sysupgrade=plat, + ret=ret, err=err, keep_avail=keep_avail}) end function _keep_pattern() diff --git a/modules/admin-full/luasrc/view/admin_system/upgrade.htm b/modules/admin-full/luasrc/view/admin_system/upgrade.htm index a3d97d649..40f3ec984 100644 --- a/modules/admin-full/luasrc/view/admin_system/upgrade.htm +++ b/modules/admin-full/luasrc/view/admin_system/upgrade.htm @@ -17,7 +17,7 @@ $Id$

<%:a_s_flash%>

<%:a_s_flash_upgrade1%>


-<% if sysupgrade and not ret then %> +<% if sysupgrade and ret == nil then %>
<%:a_s_flash_fwimage%>:
@@ -33,20 +33,14 @@ $Id$
-<% elseif ret then %> -

<%:a_s_flash_received%>

-

<%:a_s_flash_inprogress%>

- - - <% %> - <% local ret = ret() - if ret == 0 then %> -
<%:a_s_flash_flashed%>
+<% elseif ret ~= nil then %> + <% if ret then %> +

<%:a_s_flash_received%>

+

<%:a_s_flash_inprogress%>

<% else %> -
<%:a_s_flash_flasherr%>! (<%:code%> <%=ret%>)
+
<%:a_s_flash_flasherr%>! (<%=err%>)
<% end %> <% else %>
<%:a_s_flash_notimplemented%>
<% end %> <%+footer%> -<% if ret == 0 then luci.sys.reboot() end %> -- cgit v1.2.3