blob: 53ca7040641e5385180d09b93a422d6cfaadf785 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#! /usr/bin/ksh
# Original Author: Ralph Goers(rgoer@Candle.Com)
# Borrowed heavily from Tim Mooney's HP version.
# This file is distributed under the terms of the GNU General Public License
#
# find-requires is part of RPM, the RedHat Package Manager. find-requires
# reads a list of full pathnames (in a package) on stdin, and outputs all
# shared libraries the package requires to run correctly.
#
# On AIX, use `dump -H' to find the library dependencies for an executable
#
# Example dump output:
#
#$dump -H /usr/bin/dump
#
#/usr/bin/dump:
#
# ***Loader Section***
# Loader Header Information
#VERSION# #SYMtableENT #RELOCent LENidSTR
#0x00000001 0x00000021 0x0000006c 0x0000002f
#
##IMPfilID OFFidSTR LENstrTBL OFFstrTBL
#0x00000002 0x00000848 0x00000049 0x00000877
#
#
# ***Import File Strings***
#INDEX PATH BASE MEMBER
#0 /usr/lib:/lib:/usr/lpp/xlC/lib
#1 libc.a shr.o
#
#
filelist=`sed "s/['\"]/\\\&/g" | xargs file | grep -e executable -e archive | cut -d: -f1`
for f in $filelist
do
dump -H $f | awk '
#
# For you non-awk-ers, no single quotes in comments -- the shell
# sees them and things get hosed.
#
BEGIN {
in_shlib_list = 0;
in_file_strings = 0;
FS = " ";
RS = "\n";
}
in_shlib_list == 1 {
print $2
}
in_file_strings == 1 && $1 == "0" {
in_shlib_list = 1
}
/\*Import File Strings\*/ {
in_file_strings = 1
}
' # end of awk
done | sort -u
|