summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-opkg/root/usr
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-02-24 16:23:49 +0100
committerJo-Philipp Wich <jo@mein.io>2020-02-24 16:23:49 +0100
commitc6ce80e36f2e70c941492254f0ac2e8f159cb832 (patch)
tree52a129a3c858c97be00d63318664d2f614455f76 /applications/luci-app-opkg/root/usr
parent562425605af51443986cb2596199564e4102ffff (diff)
luci-app-opkg: full convert to client side actions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-opkg/root/usr')
-rwxr-xr-xapplications/luci-app-opkg/root/usr/libexec/opkg-list15
-rw-r--r--applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json36
-rw-r--r--applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json27
3 files changed, 43 insertions, 35 deletions
diff --git a/applications/luci-app-opkg/root/usr/libexec/opkg-list b/applications/luci-app-opkg/root/usr/libexec/opkg-list
new file mode 100755
index 0000000000..088bc6339a
--- /dev/null
+++ b/applications/luci-app-opkg/root/usr/libexec/opkg-list
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+case "$1" in
+ installed)
+ cat /usr/lib/opkg/status
+ ;;
+ available)
+ lists_dir=$(sed -rne 's#^lists_dir \S+ (\S+)#\1#p' /etc/opkg.conf /etc/opkg/*.conf 2>/dev/null | tail -n 1)
+ find "${lists_dir:-/tmp/opkg-lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd
+ ;;
+ *)
+ echo "Usage: $0 {installed|available}" >&2
+ exit 1
+ ;;
+esac
diff --git a/applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json b/applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json
index 9356b586dd..8632a41b3e 100644
--- a/applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json
+++ b/applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json
@@ -3,42 +3,8 @@
"title": "Software",
"order": 30,
"action": {
- "type": "template",
+ "type": "view",
"path": "opkg"
}
- },
-
- "admin/system/opkg/list/*": {
- "action": {
- "type": "call",
- "module": "luci.controller.opkg",
- "function": "action_list"
- }
- },
-
- "admin/system/opkg/exec/*": {
- "action": {
- "type": "call",
- "post": true,
- "module": "luci.controller.opkg",
- "function": "action_exec"
- }
- },
-
- "admin/system/opkg/statvfs/*": {
- "action": {
- "type": "call",
- "module": "luci.controller.opkg",
- "function": "action_statvfs"
- }
- },
-
- "admin/system/opkg/config/*": {
- "action": {
- "type": "call",
- "post": { "data": true },
- "module": "luci.controller.opkg",
- "function": "action_config"
- }
}
}
diff --git a/applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json b/applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
new file mode 100644
index 0000000000..66ef81f103
--- /dev/null
+++ b/applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
@@ -0,0 +1,27 @@
+{
+ "luci-app-opkg": {
+ "description": "Grant access to opkg management",
+ "read": {
+ "cgi-io": [ "exec" ],
+ "file": {
+ "/usr/libexec/opkg-list installed": [ "exec" ],
+ "/usr/libexec/opkg-list available": [ "exec" ],
+ "/etc/opkg.conf": [ "read" ],
+ "/etc/opkg/*.conf": [ "read" ]
+ },
+ "ubus": {
+ "luci": [ "getMountPoints" ]
+ }
+ },
+ "write": {
+ "file": {
+ "/bin/opkg * install *": [ "exec" ],
+ "/bin/opkg * remove *": [ "exec" ],
+ "/bin/opkg * update": [ "exec" ],
+ "/etc/opkg.conf": [ "write" ],
+ "/etc/opkg/*.conf": [ "write" ],
+ "/tmp/upload.ipk": [ "write" ]
+ }
+ }
+ }
+}