luci-app-opkg: support nonstandard list locations
Fixes: #3287 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
3b3a1d9cc9
commit
948c1fe602
1 changed files with 14 additions and 1 deletions
|
@ -12,12 +12,25 @@ function index()
|
||||||
end
|
end
|
||||||
|
|
||||||
function action_list(mode)
|
function action_list(mode)
|
||||||
|
local util = require "luci.util"
|
||||||
local cmd
|
local cmd
|
||||||
|
|
||||||
if mode == "installed" then
|
if mode == "installed" then
|
||||||
cmd = { "/bin/cat", "/usr/lib/opkg/status" }
|
cmd = { "/bin/cat", "/usr/lib/opkg/status" }
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
luci.http.prepare_content("text/plain; charset=utf-8")
|
luci.http.prepare_content("text/plain; charset=utf-8")
|
||||||
|
|
Loading…
Reference in a new issue