diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-11-10 18:33:49 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-10 18:33:49 +0100 |
commit | 948c1fe6023a37e72ab2db1d5b1ad7f4436add3e (patch) | |
tree | 57f592ea98331130b719ea2a4c99e26da922e36e /applications/luci-app-opkg | |
parent | 3b3a1d9cc9cd68c22003621bef2553138853f866 (diff) |
luci-app-opkg: support nonstandard list locations
Fixes: #3287
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-opkg')
-rw-r--r-- | applications/luci-app-opkg/luasrc/controller/opkg.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/applications/luci-app-opkg/luasrc/controller/opkg.lua b/applications/luci-app-opkg/luasrc/controller/opkg.lua index 39c5d1fb8..29c9a0864 100644 --- a/applications/luci-app-opkg/luasrc/controller/opkg.lua +++ b/applications/luci-app-opkg/luasrc/controller/opkg.lua @@ -12,12 +12,25 @@ function index() end function action_list(mode) + local util = require "luci.util" local cmd if mode == "installed" then cmd = { "/bin/cat", "/usr/lib/opkg/status" } else - cmd = { "/bin/sh", "-c", [[find /tmp/opkg-lists/ -type f '!' -name '*.sig' | xargs -r gzip -cd]] } + local lists_dir = nil + + local fd = io.popen([[sed -rne 's#^lists_dir \S+ (\S+)#\1#p' /etc/opkg.conf /etc/opkg/*.conf 2>/dev/null]], "r") + if fd then + lists_dir = fd:read("*l") + fd:close() + end + + if not lists_dir or #lists_dir == "" then + lists_dir = "/tmp/opkg-lists" + end + + cmd = { "/bin/sh", "-c", [[find %s -type f '!' -name '*.sig' | xargs -r gzip -cd]] % util.shellquote(lists_dir) } end luci.http.prepare_content("text/plain; charset=utf-8") |