Annotation of /trunk/depend-tools/discover_libs.sh
Parent Directory | Revision Log
Revision 331 -
(hide annotations)
(download)
(as text)
Mon Feb 20 00:14:24 2006 UTC (18 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1231 byte(s)
Mon Feb 20 00:14:24 2006 UTC (18 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1231 byte(s)
new files
1 | niro | 331 | #!/bin/bash |
2 | |||
3 | SOURCE="$1" | ||
4 | |||
5 | not_in_list() | ||
6 | { | ||
7 | local deplist="$1" | ||
8 | local dep="$2" | ||
9 | local i | ||
10 | |||
11 | for i in ${deplist} | ||
12 | do | ||
13 | [[ ${i} = ${dep} ]] && return 1 | ||
14 | done | ||
15 | |||
16 | return 0 | ||
17 | } | ||
18 | |||
19 | echo -n "resolving linking lib ... " | ||
20 | |||
21 | # first binaries: | ||
22 | for bin in $(find ${SOURCE} | xargs file | grep "executable" | grep ELF | cut -f 1 -d :) \ | ||
23 | $(find ${SOURCE} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d :) | ||
24 | do | ||
25 | while read lib | ||
26 | do | ||
27 | dep=$(echo "${lib}" | cut -d'>' -f2 | cut -d'(' -f1 | sed "s:\ ::g") | ||
28 | if [[ ${X11HACK} = true ]] | ||
29 | then | ||
30 | dep=$(echo ${dep} | sed "s:/usr/X11R6/:/usr/:g") | ||
31 | fi | ||
32 | if [[ -z $(echo ${dep} | grep "notfound") ]] | ||
33 | then | ||
34 | if not_in_list "${ALL_DEPS}" "${dep}" | ||
35 | then | ||
36 | ALL_DEPS="${ALL_DEPS} ${dep}" | ||
37 | fi | ||
38 | fi | ||
39 | done << EOF | ||
40 | $(ldd ${bin}) | ||
41 | EOF | ||
42 | done | ||
43 | echo "done" | ||
44 | |||
45 | if [[ ${DEBUG} = true ]] | ||
46 | then | ||
47 | echo | ||
48 | for i in $(echo ${ALL_DEPS} | sort ) | ||
49 | do | ||
50 | echo ${i} | ||
51 | done | ||
52 | echo | ||
53 | fi | ||
54 | |||
55 | echo -n "resolving packages ... " | ||
56 | for i in ${ALL_DEPS} | ||
57 | do | ||
58 | pkg=$(/sbin/magequery -f "${i}") | ||
59 | for z in ${pkg} | ||
60 | do | ||
61 | if not_in_list "${ALL_PACKAGES}" "${z}" | ||
62 | then | ||
63 | ALL_PACKAGES="${ALL_PACKAGES} ${z}" | ||
64 | [[ ${DEBUG} = true ]] && echo "DEBUG: ${z} ${i}" | ||
65 | fi | ||
66 | done | ||
67 | done | ||
68 | echo "done" | ||
69 | |||
70 | echo | ||
71 | for i in ${ALL_PACKAGES} | ||
72 | do | ||
73 | echo "${i}" | ||
74 | done | sort | ||
75 | echo |