2013-09-30 18:42:47 +02:00
|
|
|
<%#
|
|
|
|
LuCI - Lua Configuration Interface
|
|
|
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
|
|
|
Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
|
|
|
|
-%>
|
|
|
|
|
|
|
|
<%+header%>
|
|
|
|
|
2014-02-09 23:17:50 +01:00
|
|
|
<h2><a id="content" name="content">Flash Firmware</a></h2>
|
2013-09-30 18:42:47 +02:00
|
|
|
|
|
|
|
<% if step == 1 then %>
|
|
|
|
<% if supported then %>
|
|
|
|
<form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
|
|
|
|
<p>
|
2014-02-09 23:17:50 +01:00
|
|
|
Upload an OpenWrt image file to reflash the device.
|
2013-09-30 18:42:47 +02:00
|
|
|
<% if bad_image then %>
|
|
|
|
<br /><br />
|
2014-02-09 23:17:50 +01:00
|
|
|
<div class="error">The uploaded image file does not
|
2013-09-30 18:42:47 +02:00
|
|
|
contain a supported format. Make sure that you choose the generic
|
2014-02-09 23:17:50 +01:00
|
|
|
image format for your platform.</div>
|
2013-09-30 18:42:47 +02:00
|
|
|
<% end %>
|
|
|
|
</p>
|
|
|
|
<div>
|
2014-02-09 23:17:50 +01:00
|
|
|
Firmware image:<br />
|
2013-09-30 18:42:47 +02:00
|
|
|
<input type="hidden" name="step" value="2" />
|
|
|
|
<input type="file" size="30" name="image" />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<% if keepavail then -%>
|
|
|
|
<input type="checkbox" name="keepcfg" value="1" checked="checked" />
|
2014-02-09 23:17:50 +01:00
|
|
|
<span class="bold">Keep configuration files</span>
|
2013-09-30 18:42:47 +02:00
|
|
|
<% end -%>
|
|
|
|
|
|
|
|
<br />
|
2014-02-09 23:17:50 +01:00
|
|
|
<input class="cbi-button cbi-button-apply" type="submit" value="Upload image" />
|
2013-09-30 18:42:47 +02:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<% else %>
|
2014-02-09 23:17:50 +01:00
|
|
|
<div class="error">Sorry.
|
2013-09-30 18:42:47 +02:00
|
|
|
OpenWrt does not support a system upgrade on this platform.<br />
|
2014-02-09 23:17:50 +01:00
|
|
|
You need to manually flash your device.</div>
|
2013-09-30 18:42:47 +02:00
|
|
|
<% end %>
|
|
|
|
<% elseif step == 2 then %>
|
|
|
|
<p>
|
2014-02-09 23:17:50 +01:00
|
|
|
The flash image was uploaded.
|
2013-09-30 18:42:47 +02:00
|
|
|
Below is the checksum and file size listed,
|
|
|
|
compare them with the original file to ensure data integrity.<br />
|
2014-02-09 23:17:50 +01:00
|
|
|
Click "Proceed" below to start the flash procedure.
|
2013-09-30 18:42:47 +02:00
|
|
|
|
|
|
|
<% if flashsize > 0 and filesize > flashsize then %>
|
|
|
|
<br /><br />
|
2014-02-09 23:17:50 +01:00
|
|
|
<div class="error">It appears that you try to
|
2013-09-30 18:42:47 +02:00
|
|
|
flash an image that does not fit into the flash memory, please verify
|
2014-02-09 23:17:50 +01:00
|
|
|
the image file!</div>
|
2013-09-30 18:42:47 +02:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
<ul>
|
2014-02-09 23:17:50 +01:00
|
|
|
<li>Checksum: <code><%=checksum%></code></li>
|
|
|
|
<li>Size: <%
|
2014-02-18 22:21:31 +01:00
|
|
|
function byte_format(byte)
|
|
|
|
local suff = {"B", "KB", "MB", "GB", "TB"}
|
|
|
|
for i=1, 5 do
|
|
|
|
if byte > 1024 and i < 5 then
|
|
|
|
byte = byte / 1024
|
|
|
|
else
|
|
|
|
return string.format("%.2f %s", byte, suff[i])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
write(byte_format(filesize))
|
2013-09-30 18:42:47 +02:00
|
|
|
|
|
|
|
if flashsize > 0 then
|
|
|
|
write(luci.i18n.translatef(
|
|
|
|
" (%s available)",
|
|
|
|
w.byte_format(flashsize)
|
|
|
|
))
|
|
|
|
end
|
|
|
|
%></li>
|
|
|
|
</ul>
|
|
|
|
</p>
|
|
|
|
<div class="cbi-page-actions right">
|
|
|
|
<form style="display:inline">
|
|
|
|
<input type="hidden" name="step" value="3" />
|
|
|
|
<input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
|
2014-02-09 23:17:50 +01:00
|
|
|
<input class="cbi-button cbi-button-apply" type="submit" value="Proceed" />
|
2013-09-30 18:42:47 +02:00
|
|
|
</form>
|
|
|
|
<form style="display:inline">
|
|
|
|
<input type="hidden" name="step" value="1" />
|
|
|
|
<input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
|
2014-02-09 23:17:50 +01:00
|
|
|
<input class="cbi-button cbi-button-reset" type="submit" value="Cancel" />
|
2013-09-30 18:42:47 +02:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<% elseif step == 3 then %>
|
2014-02-09 23:17:50 +01:00
|
|
|
<p>The system is flashing now.<br />
|
2013-09-30 18:42:47 +02:00
|
|
|
DO NOT POWER OFF THE DEVICE!<br />
|
|
|
|
Wait a few minutes until you try to reconnect.
|
|
|
|
It might be necessary to renew the address of your computer to reach the device
|
2014-02-09 23:17:50 +01:00
|
|
|
again, depending on your settings.</p>
|
2013-09-30 18:42:47 +02:00
|
|
|
<% end %>
|
|
|
|
<%+footer%>
|
|
|
|
|