Skip to content

Commit d047067

Browse files
committed
Fix apk check in openmptcprouter wizard interface
1 parent 78704ca commit d047067

File tree

1 file changed

+8
-6
lines changed
  • luci-app-openmptcprouter/luasrc/view/openmptcprouter

1 file changed

+8
-6
lines changed

luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
local ifaces = sys.net:devices()
1111
local ifttyu = nixio.fs.glob("/dev/ttyUSB*")
1212
local ifttyc = nixio.fs.glob("/dev/cdc-wdm*")
13-
local sqm = luci.sys.exec("opkg list-installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
14-
if sqm == "0" then
15-
sqm = luci.sys.exec("apk list | grep installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
13+
if nixio.fs.stat('/usr/bin/apk', 'type') == 'reg' then
14+
sqm = luci.sys.exec("apk list 2>/dev/null | grep installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
15+
else
16+
sqm = luci.sys.exec("opkg list-installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
1617
end
17-
local qos = luci.sys.exec("opkg list-installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
18-
if qos == "0" then
19-
qos = luci.sys.exec("apk list | grep installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
18+
if nixio.fs.stat('/usr/bin/apk', 'type') == 'reg' then
19+
qos = luci.sys.exec("apk list 2>/dev/null | grep installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
20+
else
21+
qos = luci.sys.exec("opkg list-installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
2022
end
2123
menuentry = uci:get("openmptcprouter","settings","menu") or "openmptcprouter"
2224
function device_notvirtual(dev)

0 commit comments

Comments
 (0)