summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-09-24 11:33:21 +0200
committerJo-Philipp Wich <jo@mein.io>2019-09-24 14:21:08 +0200
commit2a5c5f47f95978c6eb5c52b41b4e931e63afa4f5 (patch)
tree6ccc8475a1def3396c73d6b19df048b5b5261a0f /modules/luci-base
parentcc786f9833a2fd294885ba979b7e68671a5aa122 (diff)
luci-mod-system: reimplement flashops as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/luasrc/sys.lua63
-rw-r--r--modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json20
2 files changed, 17 insertions, 66 deletions
diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua
index 5aede84848..f82cd78cb7 100644
--- a/modules/luci-base/luasrc/sys.lua
+++ b/modules/luci-base/luasrc/sys.lua
@@ -25,69 +25,6 @@ end
exec = luci.util.exec
-function mounts()
- local data = {}
- local k = {"fs", "blocks", "used", "available", "percent", "mountpoint"}
- local ps = luci.util.execi("df")
-
- if not ps then
- return
- else
- ps()
- end
-
- for line in ps do
- local row = {}
-
- local j = 1
- for value in line:gmatch("[^%s]+") do
- row[k[j]] = value
- j = j + 1
- end
-
- if row[k[1]] then
-
- -- this is a rather ugly workaround to cope with wrapped lines in
- -- the df output:
- --
- -- /dev/scsi/host0/bus0/target0/lun0/part3
- -- 114382024 93566472 15005244 86% /mnt/usb
- --
-
- if not row[k[2]] then
- j = 2
- line = ps()
- for value in line:gmatch("[^%s]+") do
- row[k[j]] = value
- j = j + 1
- end
- end
-
- table.insert(data, row)
- end
- end
-
- return data
-end
-
-function mtds()
- local data = {}
-
- if fs.access("/proc/mtd") then
- for l in io.lines("/proc/mtd") do
- local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"')
- if s and n then
- local d = {}
- d.size = tonumber(s, 16)
- d.name = n
- table.insert(data, d)
- end
- end
- end
-
- return data
-end
-
-- containing the whole environment is returned otherwise this function returns
-- the corresponding string value for the given name or nil if no such variable
-- exists.
diff --git a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
index af06d840d0..31c154cbcb 100644
--- a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
+++ b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
@@ -20,15 +20,22 @@
"luci-access": {
"description": "Grant access to basic LuCI procedures",
"read": {
+ "cgi-io": [ "backup", "download" ],
"file": {
"/": [ "list" ],
"/*": [ "list" ],
+ "/dev/mtdblock*": [ "read" ],
"/etc/crontabs/root": [ "read" ],
"/etc/dropbear/authorized_keys": [ "read" ],
"/etc/filesystems": [ "read" ],
"/etc/rc.local": [ "read" ],
+ "/etc/sysupgrade.conf": [ "read" ],
"/proc/filesystems": [ "read" ],
- "/proc/sys/kernel/hostname": [ "read" ]
+ "/proc/mtd": [ "read" ],
+ "/proc/partitions": [ "read" ],
+ "/proc/sys/kernel/hostname": [ "read" ],
+ "/sys/devices/virtual/mtd/*/name": [ "read" ],
+ "/sys/devices/virtual/ubi/*/name": [ "read" ]
},
"ubus": {
"file": [ "list", "read", "stat" ],
@@ -42,13 +49,20 @@
"uci": [ "*" ]
},
"write": {
- "cgi-io": [ "upload", "/etc/luci-uploads/*" ],
+ "cgi-io": [ "upload" ],
"file": {
"/etc/crontabs/root": [ "write" ],
"/etc/dropbear/authorized_keys": [ "write" ],
"/etc/luci-uploads/*": [ "write" ],
"/etc/rc.local": [ "write" ],
- "/sbin/block": [ "exec" ]
+ "/etc/sysupgrade.conf": [ "write" ],
+ "/sbin/block": [ "exec" ],
+ "/sbin/firstboot": [ "exec" ],
+ "/sbin/reboot": [ "exec" ],
+ "/sbin/sysupgrade": [ "exec" ],
+ "/bin/tar": [ "exec" ],
+ "/tmp/backup.tar.gz": [ "write" ],
+ "/tmp/firmware.bin": [ "write" ]
},
"ubus": {
"file": [ "write", "remove", "exec" ],