425113e62dc91d2209f4b2625ab7b92a0dde7d1f
[project/luci.git] / modules / admin-mini / luasrc / view / mini / upgrade.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15
16 <%+header%>
17
18 <h2><a id="content" name="content"><%:system%></a></h2>
19 <h3><%:admin_upgrade Flash Firmware%></h3>
20
21 <% if step == 1 then %>
22         <% if supported then %>
23         <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
24         <p>
25                 <%:admin_upgrade_desc Upload an OpenWrt image file to reflash the device.%>
26                 <% if bad_image then %>
27                         <br /><br />
28                         <div class="error"><%:admin_upgrade_badimage The uploaded image file does not
29                                 contain a supported format. Make sure that you choose the generic
30                                 image format for your platform. %></div>
31                 <% end %>
32         </p>
33         <div>
34                 <%:admin_upgrade_fwimage Firmware image%>:<br />
35                 <input type="hidden" name="step" value="2" />
36                 <input type="file" size="30" name="image" />
37                 <br />
38                 <br />
39                 <% if keepavail then -%>
40                 <input type="checkbox" name="keepcfg" value="1" checked="checked" />
41                 <span class="bold"><%:admin_upgrade_keepcfg Keep configuration files%></span>
42                 <% end -%>
43
44                 <br />
45                 <input class="cbi-button cbi-button-apply" type="submit" value="<%:admin_upgrade_upload Upload image%>" />
46         </div>
47         </form>
48         <% else %>
49                 <div class="error"><%:admin_upgrade_nosupport Sorry.
50                         OpenWrt does not support a system upgrade on this platform.<br />
51                         You need to manually flash your device. %></div>
52         <% end %>
53 <% elseif step == 2 then %>
54         <p>
55                 <%:admin_upgrade_uploaded The flash image was uploaded.
56                         Below is the checksum and file size listed,
57                         compare them with the original file to ensure data integrity.<br />
58                         Click "Proceed" below to start the flash procedure. %>
59
60                 <% if flashsize > 0 and filesize > flashsize then %>
61                         <br /><br />
62                         <div class="error"><%:admin_upgrade_toolarge It appears that you try to
63                                 flash an image that does not fit into the flash memory, please verify
64                                 the image file! %></div>
65                 <% end %>
66
67                 <br />
68                 <ul>
69                         <li><%:admin_upgrade_checksum Checksum%>: <code><%=checksum%></code></li>
70                         <li><%:admin_upgrade_filesize Size%>: <%
71                                 local w = require "luci.tools.webadmin"
72                                 write(w.byte_format(filesize))
73         
74                                 if flashsize > 0 then
75                                         write(luci.i18n.translatef(
76                                                 "admin_upgrade_spaceavail",
77                                                 " (%s available)",
78                                                 w.byte_format(flashsize)
79                                         ))
80                                 end
81                         %></li>
82                 </ul>
83         </p>
84         <div class="cbi-page-actions right">
85                 <form style="display:inline">
86                         <input type="hidden" name="step" value="3" />
87                         <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
88                         <input class="cbi-button cbi-button-apply" type="submit" value="<%:proceed Proceed%>" />        
89                 </form>
90                 <form style="display:inline">
91                         <input type="hidden" name="step" value="1" />
92                         <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
93                         <input class="cbi-button cbi-button-reset" type="submit" value="<%:cancel Cancel%>" />
94                 </form>
95         </div>
96 <% elseif step == 3 then %>
97         <p><%:admin_upgrade_running The system is flashing now.<br />
98                 DO NOT POWER OFF THE DEVICE!<br />
99                 Wait a few minutes until you try to reconnect.
100                 It might be necessary to renew the address of your computer to reach the device
101                 again, depending on your settings. %></p>
102                 
103         <iframe src="<%=REQUEST_URI%>?step=4&#38;keepcfg=<%=keepconfig and "1" or "0"%>" style="border:1px solid black; width:100%; height:150px"></iframe>
104 <% end %>
105 <%+footer%>
106