mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
make.sh: Add command to find dependencies
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
cb9fd5923b
commit
ba137dd898
32
tools/find-dependencies
Executable file
32
tools/find-dependencies
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
main() {
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "${0}: Usage: PATH LIBRARY ..."
|
||||
return 2
|
||||
fi
|
||||
|
||||
local root="${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${root}" ]; then
|
||||
echo "${0}: ${root}: No such file or directory"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local libraries="$@"
|
||||
|
||||
# Build the regex filter
|
||||
local filter="(${libraries[*]// /|})"
|
||||
|
||||
local file
|
||||
for file in $(find "${root}" -xdev -type f -executable); do
|
||||
if readelf -d "${file}" 2>/dev/null | grep -qE "NEEDED.*\[${filter}\]$"; then
|
||||
echo "${file}"
|
||||
fi
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
main "$@" || exit $?
|
||||
Reference in New Issue
Block a user