1996-11-22 06:16:00 +08:00
|
|
|
#!/bin/sh
|
1996-11-22 05:58:50 +08:00
|
|
|
|
|
|
|
# note this works for both a.out and ELF executables
|
1997-09-01 23:55:56 +08:00
|
|
|
# it also auto-generates requirment lines for shell scripts
|
1996-11-22 05:58:50 +08:00
|
|
|
|
1996-11-22 06:06:06 +08:00
|
|
|
ulimit -c 0
|
|
|
|
|
1997-09-01 23:55:56 +08:00
|
|
|
filelist=`sed "s/['\"]/\\\&/g"`
|
2000-02-18 00:26:52 +08:00
|
|
|
exelist=`echo $filelist | xargs -r file | grep ":.*executable" | cut -d: -f1 `
|
1998-12-04 03:36:01 +08:00
|
|
|
scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 `
|
2000-02-18 00:26:52 +08:00
|
|
|
liblist=`echo $filelist | xargs -r file | grep ":.*shared object" | cut -d : -f1 `
|
1996-11-22 05:58:50 +08:00
|
|
|
|
1997-09-01 23:55:56 +08:00
|
|
|
for f in $exelist; do
|
1997-10-11 03:10:36 +08:00
|
|
|
if [ -x $f ]; then
|
|
|
|
ldd $f | awk '/=>/ { print $1 }'
|
|
|
|
fi
|
1999-06-19 01:47:59 +08:00
|
|
|
done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u
|
1996-11-22 06:16:00 +08:00
|
|
|
|
1998-04-02 00:02:05 +08:00
|
|
|
for f in $liblist; do
|
|
|
|
ldd $f | awk '/=>/ { print $1 }'
|
1999-06-18 04:18:08 +08:00
|
|
|
done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u
|
1998-04-02 00:02:05 +08:00
|
|
|
|
1997-09-01 23:55:56 +08:00
|
|
|
for f in $scriptlist; do
|
1997-10-11 03:10:36 +08:00
|
|
|
if [ -x $f ]; then
|
|
|
|
head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1
|
|
|
|
fi
|
1997-09-01 23:55:56 +08:00
|
|
|
done | sort -u
|
1999-02-16 02:26:09 +08:00
|
|
|
|
|
|
|
for f in $liblist $exelist ; do
|
|
|
|
objdump -p $f | awk '
|
|
|
|
BEGIN { START=0; LIBNAME=""; }
|
|
|
|
/Version References:/ { START=1; }
|
|
|
|
/required from/ && (START==1) {
|
|
|
|
sub(/:/, "", $3);
|
|
|
|
LIBNAME=$3;
|
|
|
|
}
|
2000-03-11 00:53:08 +08:00
|
|
|
(START==1) && (LIBNAME!="") && ($4~=/^GLIBC_*/) { print LIBNAME "(" $4 ")"; }
|
1999-02-16 02:26:09 +08:00
|
|
|
/^$/ { START=0; }
|
|
|
|
'
|
1999-06-18 04:18:08 +08:00
|
|
|
done | sort -u
|