mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-16 08:44:29 +00:00
fix: check package manager existence
This commit is contained in:
parent
a84cfc87bf
commit
e1e02929f8
@ -11,15 +11,19 @@ local ListValue = cbi.ListValue
|
||||
local DummyValue = cbi.DummyValue
|
||||
local TextValue = cbi.TextValue
|
||||
|
||||
function cmd_exists(cmd)
|
||||
return sys.call("command -v " .. cmd .. " >/dev/null 2>&1") == 0
|
||||
end
|
||||
|
||||
function nfqueue_exists()
|
||||
local opkg = sys.call("opkg list-installed kmod-nft-queue | grep -q kmod-nft-queue") == 0
|
||||
local apk = sys.call("apk info | grep -q kmod-nft-queue") == 0
|
||||
local opkg = cmd_exists("opkg") and sys.call("opkg list-installed kmod-nft-queue | grep -q kmod-nft-queue") == 0
|
||||
local apk = cmd_exists("apk") and (sys.call("apk info | grep -q kmod-nft-queue") == 0)
|
||||
return opkg or apk
|
||||
end
|
||||
|
||||
function tproxy_exists()
|
||||
local opkg = sys.call("opkg list-installed kmod-nft-tproxy | grep -q kmod-nft-tproxy") == 0
|
||||
local apk = sys.call("apk info | grep -q kmod-nft-tproxy") == 0
|
||||
local opkg = cmd_exists("opkg") and sys.call("opkg list-installed kmod-nft-tproxy | grep -q kmod-nft-tproxy") == 0
|
||||
local apk = cmd_exists("apk") and (sys.call("apk info | grep -q kmod-nft-tproxy") == 0)
|
||||
return opkg or apk
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user