diff options
Diffstat (limited to 'modules')
4 files changed, 34 insertions, 20 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 55087a0177..5d64336e03 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, err + local ret 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,11 +208,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("admin_system/upgrade", {sysupgrade=plat, ret=ret, 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 40f3ec9844..a3d97d6497 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$ <h2><%:a_s_flash%></h2> <p><%:a_s_flash_upgrade1%></p> <br /> -<% if sysupgrade and ret == nil then %> +<% if sysupgrade and not ret then %> <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data"> <div class="left"><%:a_s_flash_fwimage%>:</div> <div> @@ -33,14 +33,20 @@ $Id$ <input type="submit" value="<%:a_s_flash_fwupgrade%>" /> </div> </form> -<% elseif ret ~= nil then %> - <% if ret then %> -<p><%:a_s_flash_received%></p> -<p><%:a_s_flash_inprogress%></p> +<% elseif ret then %> + <p><%:a_s_flash_received%></p> + <p><%:a_s_flash_inprogress%></p> + +<!-- <%=string.rep(" ", 2048)%> --> + <% %> + <% local ret = ret() + if ret == 0 then %> +<div class="ok"><%:a_s_flash_flashed%></div> <% else %> -<div class="error"><%:a_s_flash_flasherr%>! (<%=err%>)</div> +<div class="error"><%:a_s_flash_flasherr%>! (<%:code%> <%=ret%>)</div> <% end %> <% else %> <div class="error"><%:a_s_flash_notimplemented%></div> <% end %> <%+footer%> +<% if ret == 0 then luci.sys.reboot() end %> diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index d68283cc62..6d16ef8650 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -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() diff --git a/modules/admin-mini/luasrc/view/mini/upgrade.htm b/modules/admin-mini/luasrc/view/mini/upgrade.htm index 40f3ec9844..a3d97d6497 100644 --- a/modules/admin-mini/luasrc/view/mini/upgrade.htm +++ b/modules/admin-mini/luasrc/view/mini/upgrade.htm @@ -17,7 +17,7 @@ $Id$ <h2><%:a_s_flash%></h2> <p><%:a_s_flash_upgrade1%></p> <br /> -<% if sysupgrade and ret == nil then %> +<% if sysupgrade and not ret then %> <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data"> <div class="left"><%:a_s_flash_fwimage%>:</div> <div> @@ -33,14 +33,20 @@ $Id$ <input type="submit" value="<%:a_s_flash_fwupgrade%>" /> </div> </form> -<% elseif ret ~= nil then %> - <% if ret then %> -<p><%:a_s_flash_received%></p> -<p><%:a_s_flash_inprogress%></p> +<% elseif ret then %> + <p><%:a_s_flash_received%></p> + <p><%:a_s_flash_inprogress%></p> + +<!-- <%=string.rep(" ", 2048)%> --> + <% %> + <% local ret = ret() + if ret == 0 then %> +<div class="ok"><%:a_s_flash_flashed%></div> <% else %> -<div class="error"><%:a_s_flash_flasherr%>! (<%=err%>)</div> +<div class="error"><%:a_s_flash_flasherr%>! (<%:code%> <%=ret%>)</div> <% end %> <% else %> <div class="error"><%:a_s_flash_notimplemented%></div> <% end %> <%+footer%> +<% if ret == 0 then luci.sys.reboot() end %> |