From 58d97b5e271bc0d7507eab5b9bd2902181864e02 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Fri, 3 Aug 2018 12:36:51 -0400 Subject: modules: Split luci-mod-full Move some common elements to luci-base, and otherwise make three packages out of status, system, and network. They were mostly separated already, but there were some shared elements between status and network that are now in luci-base. Signed-off-by: Daniel F. Dickinson --- .../luasrc/view/admin_system/applyreboot.htm | 53 +++++ .../luasrc/view/admin_system/backupfiles.htm | 10 + .../luasrc/view/admin_system/clock_status.htm | 36 ++++ .../luasrc/view/admin_system/flashops.htm | 137 +++++++++++++ .../luasrc/view/admin_system/ipkg.htm | 10 + .../luasrc/view/admin_system/packages.htm | 213 +++++++++++++++++++++ .../luasrc/view/admin_system/reboot.htm | 62 ++++++ .../luasrc/view/admin_system/upgrade.htm | 65 +++++++ 8 files changed, 586 insertions(+) create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/applyreboot.htm create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/backupfiles.htm create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/flashops.htm create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/ipkg.htm create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/packages.htm create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/reboot.htm create mode 100644 modules/luci-mod-system/luasrc/view/admin_system/upgrade.htm (limited to 'modules/luci-mod-system/luasrc/view') diff --git a/modules/luci-mod-system/luasrc/view/admin_system/applyreboot.htm b/modules/luci-mod-system/luasrc/view/admin_system/applyreboot.htm new file mode 100644 index 000000000..e235bd467 --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/applyreboot.htm @@ -0,0 +1,53 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + + + + <%=luci.sys.hostname()%> - <%= title or translate("Rebooting...") %> + + + + + +
+
+
+

<%=luci.sys.hostname() or "?"%>

+
+
+
+   +
+
+
+

<%:System%> - <%= title or translate("Rebooting...") %>

+
+
+ <%= msg or translate("Changes applied.") %> +
+
+ <%:Loading%> + <%:Waiting for changes to be applied...%> +
+
+
+
+
+ + \ No newline at end of file diff --git a/modules/luci-mod-system/luasrc/view/admin_system/backupfiles.htm b/modules/luci-mod-system/luasrc/view/admin_system/backupfiles.htm new file mode 100644 index 000000000..c1f3361ae --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/backupfiles.htm @@ -0,0 +1,10 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + + diff --git a/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm b/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm new file mode 100644 index 000000000..37d8ae0e8 --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm @@ -0,0 +1,36 @@ +<%+cbi/valueheader%> + + + +<%:Collecting data...%> + + +<%+cbi/valuefooter%> diff --git a/modules/luci-mod-system/luasrc/view/admin_system/flashops.htm b/modules/luci-mod-system/luasrc/view/admin_system/flashops.htm new file mode 100644 index 000000000..8204d38e3 --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/flashops.htm @@ -0,0 +1,137 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008-2015 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + +<%+header%> + +

<%:Flash operations%>

+ + + +
+

<%:Backup%>

+
<%:Click "Generate archive" to download a tar archive of the current configuration files.%>
+
+
+ +
+ +
+ +
+
+
+
+ +

<%:Restore%>

+
<%: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).%>
+
+ <% if reset_avail then %> +
+ +
+ +
+ +
+
+
+ <% end %> +
+
+ +
+ + + + <% if reset_avail then %> +
<%:Custom files (certificates, scripts) may remain on the system. To prevent this, perform a factory-reset first.%>
+ <% end %> +
+
+
+ <% if backup_invalid then %> +
<%:The backup archive does not appear to be a valid gzip file.%>
+ <% end %> +
+ + <% local mtds = require("luci.sys").mtds(); if #mtds > 0 then -%> +

<%:Save mtdblock contents%>

+
<%:Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )%>
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ <% end %> + +
+ +
+

<%:Flash new firmware image%>

+ <% if upgrade_avail then %> +
+ +
<%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires a compatible firmware image).%>
+
+
+ +
+ +
+
+ <% if image_invalid then %> +
+ +
+ +
+
+ <%:The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform. %> + <%: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! %> +
+
+ <% end %> +
+ +
+ + +
+
+
+
+ <% else %> +
<%: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.%>
+ <% end %> +
+ +<%+footer%> diff --git a/modules/luci-mod-system/luasrc/view/admin_system/ipkg.htm b/modules/luci-mod-system/luasrc/view/admin_system/ipkg.htm new file mode 100644 index 000000000..a7ff4e50b --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/ipkg.htm @@ -0,0 +1,10 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + + diff --git a/modules/luci-mod-system/luasrc/view/admin_system/packages.htm b/modules/luci-mod-system/luasrc/view/admin_system/packages.htm new file mode 100644 index 000000000..280eabb8e --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/packages.htm @@ -0,0 +1,213 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008-2010 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + +<%- +local opkg = require "luci.model.ipkg" +local fs = require "nixio.fs" +local wa = require "luci.tools.webadmin" +local rowcnt = 1 + +function rowstyle() + rowcnt = rowcnt + 1 + return (rowcnt % 2) + 1 +end + +local fstat = fs.statvfs(opkg.overlay_root()) +local space_total = fstat and fstat.blocks or 0 +local space_free = fstat and fstat.bfree or 0 +local space_used = space_total - space_free + +local used_perc = math.floor(0.5 + ((space_total > 0) and ((100 / space_total) * space_used) or 100)) +local free_byte = space_free * fstat.frsize + +local filter = { } + + +local opkg_list = luci.model.ipkg.list_all +local querypat +if query and #query > 0 then + querypat = '*%s*' % query + opkg_list = luci.model.ipkg.find +end + +local letterpat +if letter == 35 then + letterpat = "[^a-z]*" +else + letterpat = string.char(letter, 42) -- 'A' '*' +end + +-%> + +<%+header%> + + +

<%:Software%>

+ +
+ + + +
+ + + +
+
+ <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %> +
+ <% if #stdout > 0 then %>
<%=pcdata(stdout)%>
<% end %> + <% if #stderr > 0 then %>
<%=pcdata(stderr)%>
<% end %> +
+ <% end %> + + <% if querypat then %> +
+ <%:Displaying only packages containing%> "<%=pcdata(query)%>" + +
+
+ <% end %> + + <% if no_lists or old_lists then %> +
+ <% if old_lists then %> + <%:Package lists are older than 24 hours%> + <% else %> + <%:No package lists available%> + <% end %> + +
+ <% end %> + +
+ <%:Free space%>: <%=(100-used_perc)%>% (<%=wa.byte_format(free_byte)%>) +
+
 
+
+
+
+ +
+ +
+ + +
+ +
+ + +
+
+ +
+ +
+ + +
+
+
+
+
+ + +

<%:Status%>

+ + + + + <% if display ~= "available" then %> +
+
+
+
+
<%:Package name%>
+
<%:Version%>
+
 
+
+ <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, s, d) empty = false; filter[n] = true %> +
+
<%=luci.util.pcdata(n)%>
+
<%=luci.util.pcdata(v)%>
+
+
+ + + + +
+
+
+ <% end) %> + <% if empty then %> +
+
 
+
<%:none%>
+
<%:none%>
+
+ <% end %> +
+
+
+ <% else %> +
+ <% if not querypat then %> + + <% end %> +
+
+
+
<%:Package name%>
+
<%:Version%>
+
<%:Size (.ipk)%>
+
<%:Description%>
+
 
+
+ <% local empty = true; opkg_list(querypat or letterpat, function(n, v, s, d) if filter[n] then return end; empty = false %> +
+
<%=luci.util.pcdata(n)%>
+
<%=luci.util.pcdata(v)%>
+
<%=luci.util.pcdata(s)%>
+
<%=luci.util.pcdata(d)%>
+
+
+ + + + +
+
+
+ <% end) %> + <% if empty then %> +
+
 
+
<%:none%>
+
<%:none%>
+
<%:none%>
+
<%:none%>
+
+ <% end %> +
+
+
+ <% end %> +
+ +<%+footer%> diff --git a/modules/luci-mod-system/luasrc/view/admin_system/reboot.htm b/modules/luci-mod-system/luasrc/view/admin_system/reboot.htm new file mode 100644 index 000000000..d23664ada --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/reboot.htm @@ -0,0 +1,62 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008-2015 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + +<%+header%> + +

<%:Reboot%>

+ +

<%:Reboots the operating system of your device%>

+ +<%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%> +

<%:Warning: There are unsaved changes that will get lost on reboot!%>

+<%- end -%> + +
+ + + + + + + +<%+footer%> diff --git a/modules/luci-mod-system/luasrc/view/admin_system/upgrade.htm b/modules/luci-mod-system/luasrc/view/admin_system/upgrade.htm new file mode 100644 index 000000000..597ddfd6b --- /dev/null +++ b/modules/luci-mod-system/luasrc/view/admin_system/upgrade.htm @@ -0,0 +1,65 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008-2009 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + +<%+header%> + +

<%:Flash Firmware%> - <%:Verify%>

+

+ <%_ The flash image was uploaded. + Below is the checksum and file size listed, + compare them with the original file to ensure data integrity.
+ Click "Proceed" below to start the flash procedure. %> + + <% if storage > 0 and size > storage then %> +

+

<%:It appears that you are trying to + flash an image that does not fit into the flash memory, please verify + the image file! %>
+ <% end %> + +

+ +
+
    +
  • <%:Checksum%>
    + <%:MD5%>: <%=checksum%>
    + <%:SHA256%>: <%=sha256ch%>
  • +
  • <%:Size%>: <% + local w = require "luci.tools.webadmin" + write(w.byte_format(size)) + + if storage > 0 then + write(luci.i18n.translatef( + " (%s available)", + w.byte_format(storage) + )) + end + %>
  • +
  • <% if keep then %> + <%:Configuration files will be kept%> + <% else %> + <%:Caution: Configuration files will be erased%> + <% end %>
  • + <% if force then %> +
  • + <%:Caution: System upgrade will be forced%> +
  • + <% end %> +
+
+ +
+
+ + + " /> + " /> + + +
+
+ +<%+footer%> -- cgit v1.2.3