mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-17 01:06:13 +00:00
fix: skip opkg lock check
This commit is contained in:
parent
426255f5ee
commit
8c40693363
@ -6,16 +6,30 @@ local function cmd_exists(cmd)
|
|||||||
return sys.call("command -v " .. cmd .. " >/dev/null 2>&1") == 0
|
return sys.call("command -v " .. cmd .. " >/dev/null 2>&1") == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function opkg_installed(pkg)
|
||||||
|
if not cmd_exists("opkg") then return false end
|
||||||
|
local output = sys.exec("opkg list-installed " .. pkg .. " 2>&1")
|
||||||
|
if output:find(pkg, 1, true) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
if output:find("Could not lock /var/lock/opkg.lock", 1, true) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function apk_installed(pkg)
|
||||||
|
if not cmd_exists("apk") then return false end
|
||||||
|
local output = sys.exec("apk info | grep " .. pkg .. " 2>&1")
|
||||||
|
return output:find(pkg, 1, true) ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
function M.nfqueue_exists()
|
function M.nfqueue_exists()
|
||||||
local opkg = cmd_exists("opkg") and sys.call("opkg list-installed kmod-nft-queue | grep -q kmod-nft-queue") == 0
|
return opkg_installed("kmod-nft-queue") or apk_installed("kmod-nft-queue")
|
||||||
local apk = cmd_exists("apk") and (sys.call("apk info | grep -q kmod-nft-queue") == 0)
|
|
||||||
return opkg or apk
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.tproxy_exists()
|
function M.tproxy_exists()
|
||||||
local opkg = cmd_exists("opkg") and sys.call("opkg list-installed kmod-nft-tproxy | grep -q kmod-nft-tproxy") == 0
|
return opkg_installed("kmod-nft-tproxy") or apk_installed("kmod-nft-tproxy")
|
||||||
local apk = cmd_exists("apk") and (sys.call("apk info | grep -q kmod-nft-tproxy") == 0)
|
|
||||||
return opkg or apk
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.offloading_enabled()
|
function M.offloading_enabled()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user