]>
Commit | Line | Data |
---|---|---|
ba137dd8 MT |
1 | #!/bin/bash |
2 | ||
3 | main() { | |
4 | if [ $# -lt 2 ]; then | |
5 | echo "${0}: Usage: PATH LIBRARY ..." | |
6 | return 2 | |
7 | fi | |
8 | ||
9 | local root="${1}" | |
10 | shift | |
11 | ||
12 | if [ ! -d "${root}" ]; then | |
13 | echo "${0}: ${root}: No such file or directory" | |
14 | return 1 | |
15 | fi | |
16 | ||
17 | local libraries="$@" | |
18 | ||
19 | # Build the regex filter | |
20 | local filter="(${libraries[*]// /|})" | |
21 | ||
22 | local file | |
23 | for file in $(find "${root}" -xdev -type f -executable); do | |
24 | if readelf -d "${file}" 2>/dev/null | grep -qE "NEEDED.*\[${filter}\]$"; then | |
25 | echo "${file}" | |
26 | fi | |
27 | done | |
28 | ||
29 | return 0 | |
30 | } | |
31 | ||
32 | main "$@" || exit $? |