mirror of
https://github.com/openwrt/luci.git
synced 2026-08-31 17:01:56 +04:00
Merge pull request #678 from cshore/pull-request-lib-depends
luci-base: Add option to check linked libraries
This commit is contained in:
@@ -636,6 +636,23 @@ function libpath()
|
|||||||
return require "nixio.fs".dirname(ldebug.__file__)
|
return require "nixio.fs".dirname(ldebug.__file__)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function checklib(fullpathexe, wantedlib)
|
||||||
|
local fs = require "nixio.fs"
|
||||||
|
local haveldd = fs.access('/usr/bin/ldd')
|
||||||
|
if not haveldd then
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
local libs = exec("/usr/bin/ldd " .. fullpathexe)
|
||||||
|
if not libs then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
for k, v in ipairs(split(libs)) do
|
||||||
|
if v:find(wantedlib) then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Coroutine safe xpcall and pcall versions modified for Luci
|
-- Coroutine safe xpcall and pcall versions modified for Luci
|
||||||
|
|||||||
Reference in New Issue
Block a user