- fix: noLibio = 0 on Red Hat 4.x and 5.x.
[platform/upstream/rpm.git] / autodeps / linux.req
1 #!/bin/sh
2
3 # note this works for both a.out and ELF executables
4 # it also auto-generates requirment lines for shell scripts
5
6 ulimit -c 0
7
8 filelist=`sed "s/['\"]/\\\&/g"`
9 exelist=`echo $filelist | xargs -r file | grep ":.*executable" | cut -d: -f1 `
10 scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 `
11 liblist=`echo $filelist | xargs -r file | grep ":.*shared object" | cut -d : -f1 `
12
13 for f in $exelist; do
14     if [ -x $f ]; then
15         ldd $f | awk '/=>/ { print $1 }'
16     fi
17 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u
18
19 for f in $liblist; do
20     ldd $f | awk '/=>/ { print $1 }'
21 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u
22
23 for f in $scriptlist; do
24     if [ -x $f ]; then
25         head -1 $f | sed -e 's/^\#\![   ]*//' | cut -d" " -f1
26     fi
27 done | sort -u
28
29 for f in $liblist $exelist ; do
30     objdump -p $f | awk '
31         BEGIN { START=0; LIBNAME=""; }
32         /Version References:/ { START=1; }
33         /required from/ && (START==1) {
34             sub(/:/, "", $3);
35             LIBNAME=$3;
36         }
37         (START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) { print LIBNAME "(" $4 ")"; }
38         /^$/ { START=0; }
39     '
40 done | sort -u