modules: Split luci-mod-full
[project/luci.git] / modules / luci-mod-system / luasrc / view / admin_system / flashops.htm
1 <%#
2 Copyright 2008 Steven Barth <steven@midlink.org>
3 Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
4 Licensed to the public under the Apache License 2.0.
5 -%>
6
7 <%+header%>
8
9 <h2 name="content"><%:Flash operations%></h2>
10
11 <ul class="cbi-tabmenu">
12 <li class="cbi-tab"><a href="#"><%:Actions%></a></li>
13 <li class="cbi-tab-disabled"><a href="<%=url('admin/system/flashops/backupfiles')%>"><%:Configuration%></a></li>
14 </ul>
15
16 <div class="cbi-section">
17 <h3><%:Backup%></h3>
18 <div class="cbi-section-descr"><%:Click "Generate archive" to download a tar archive of the current configuration files.%></div>
19 <div class="cbi-section-node">
20 <form class="inline" method="post" action="<%=url('admin/system/flashops/backup')%>">
21 <input type="hidden" name="token" value="<%=token%>" />
22 <div class="cbi-value<% if not reset_avail then %> cbi-value-last<% end %>">
23 <label class="cbi-value-title" for="image"><%:Download backup%></label>
24 <div class="cbi-value-field">
25 <input class="cbi-button cbi-button-action important" type="submit" name="backup" value="<%:Generate archive%>" />
26 </div>
27 </div>
28 </form>
29 </div>
30
31 <h3><%:Restore%></h3>
32 <div class="cbi-section-descr"><%:To restore configuration files, you can upload a previously generated backup archive here. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></div>
33 <div class="cbi-section-node">
34 <% if reset_avail then %>
35 <form class="inline" method="post" action="<%=url('admin/system/flashops/reset')%>">
36 <input type="hidden" name="token" value="<%=token%>" />
37 <div class="cbi-value cbi-value-last">
38 <label class="cbi-value-title"><%:Reset to defaults%></label>
39 <div class="cbi-value-field">
40 <input onclick="return confirm('<%:Really reset all changes?%>')" class="cbi-button cbi-button-reset" type="submit" name="reset" value="<%:Perform reset%>" />
41 </div>
42 </div>
43 </form>
44 <% end %>
45 <form class="inline" method="post" action="<%=url('admin/system/flashops/restore')%>" enctype="multipart/form-data">
46 <div class="cbi-value cbi-value-last">
47 <label class="cbi-value-title" for="archive"><%:Restore backup%></label>
48 <div class="cbi-value-field">
49 <input type="hidden" name="token" value="<%=token%>" />
50 <input type="file" name="archive" id="archive" />
51 <input type="submit" class="cbi-button cbi-button-action important" name="restore" value="<%:Upload archive...%>" />
52 <% if reset_avail then %>
53 <div class="cbi-value-description"><%:Custom files (certificates, scripts) may remain on the system. To prevent this, perform a factory-reset first.%></div>
54 <% end %>
55 </div>
56 </div>
57 </form>
58 <% if backup_invalid then %>
59 <div class="cbi-section-error"><%:The backup archive does not appear to be a valid gzip file.%></div>
60 <% end %>
61 </div>
62
63 <% local mtds = require("luci.sys").mtds(); if #mtds > 0 then -%>
64 <h3><%:Save mtdblock contents%></h3>
65 <div class="cbi-section-descr"><%:Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )%></div>
66 <div class="cbi-section-node">
67 <form class="inline" method="post" action="<%=url('admin/system/flashops/backupmtdblock')%>">
68 <input type="hidden" name="token" value="<%=token%>" />
69 <div class="cbi-value">
70 <label class="cbi-value-title" for="mtdblockname"><%:Choose mtdblock%></label>
71 <div class="cbi-value-field">
72 <select class="cbi-input-select" data-update="change" name="mtdblockname" id="mtdblockname">
73 <% for i, key in ipairs(mtds) do
74 if key and key.name ~= "rootfs_data" then -%>
75 <option<%=
76 attr("id", "mtdblockname-" .. key.name) ..
77 attr("value", key.name .. '/'.. key.size .. '/' .. i - 1) ..
78 attr("data-index", i) ..
79 ifattr(key.name == "linux" or key.name == "firmware", "selected", "selected")
80 %>><%=pcdata(key.name)%></option>
81 <% end
82 end -%>
83 </select>
84 </div>
85 </div>
86 <div class="cbi-value cbi-value-last<% if reset_avail then %> cbi-value-error<% end %>">
87 <label class="cbi-value-title" for="image"><%:Download mtdblock%></label>
88 <div class="cbi-value-field">
89 <input type="submit" class="cbi-button cbi-button-action important" value="<%:Save mtdblock%>" />
90 </div>
91 </div>
92 </form>
93 </div>
94 <% end %>
95
96 </div>
97
98 <div class="cbi-section">
99 <h3><%:Flash new firmware image%></h3>
100 <% if upgrade_avail then %>
101 <form method="post" action="<%=url('admin/system/flashops/sysupgrade')%>" enctype="multipart/form-data">
102 <input type="hidden" name="token" value="<%=token%>" />
103 <div class="cbi-section-descr"><%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires a compatible firmware image).%></div>
104 <div class="cbi-section-node">
105 <div class="cbi-value">
106 <label class="cbi-value-title" for="keep"><%:Keep settings%></label>
107 <div class="cbi-value-field">
108 <input type="checkbox" name="keep" id="keep" checked="checked" />
109 </div>
110 </div>
111 <% if image_invalid then %>
112 <div class="cbi-value">
113 <label class="cbi-value-title" for="force"><%:Force upgrade%></label>
114 <div class="cbi-value-field">
115 <input type="checkbox" name="force" id="force" />
116 </div>
117 <div class="cbi-section-error">
118 <%:The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform. %>
119 <%:Select 'Force upgrade' to flash the image even if the image format check fails. Use only if you are sure that the firmware is correct and meant for your device! %>
120 </div>
121 </div>
122 <% end %>
123 <div class="cbi-value cbi-value-last<% if image_invalid then %> cbi-value-error<% end %>">
124 <label class="cbi-value-title" for="image"><%:Image%></label>
125 <div class="cbi-value-field">
126 <input type="file" name="image" id="image" />
127 <input type="submit" class="cbi-button cbi-button-action important" value="<%:Flash image...%>" />
128 </div>
129 </div>
130 </div>
131 </form>
132 <% else %>
133 <div class="cbi-section-descr"><%:Sorry, there is no sysupgrade support present; a new firmware image must be flashed manually. Please refer to the wiki for device specific install instructions.%></div>
134 <% end %>
135 </div>
136
137 <%+footer%>