2001-06-02 03:27:33 +08:00
|
|
|
#!/bin/bash
|
1996-11-22 05:58:50 +08:00
|
|
|
|
2001-06-02 03:27:33 +08:00
|
|
|
#
|
|
|
|
# Auto-generate requirements for executables (both ELF and a.out) and library
|
|
|
|
# sonames, script interpreters, and perl modules.
|
|
|
|
#
|
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"`
|
2001-06-02 03:27:33 +08:00
|
|
|
exelist=`echo $filelist | xargs -r file | egrep -v ":.* (commands|script) " | \
|
|
|
|
grep ":.*executable" | cut -d: -f1`
|
|
|
|
scriptlist=`echo $filelist | xargs -r file | \
|
|
|
|
egrep ":.* (commands|script) " | cut -d: -f1`
|
|
|
|
liblist=`echo $filelist | xargs -r file | \
|
|
|
|
grep ":.*shared object" | cut -d : -f1`
|
1996-11-22 05:58:50 +08:00
|
|
|
|
2001-06-02 03:27:33 +08:00
|
|
|
interplist=
|
|
|
|
perllist=
|
|
|
|
pythonlist=
|
|
|
|
tcllist=
|
|
|
|
|
2001-06-16 00:01:10 +08:00
|
|
|
#
|
|
|
|
# --- Alpha does not mark 64bit dependencies
|
|
|
|
case `uname -m` in
|
|
|
|
alpha*) mark64="" ;;
|
|
|
|
*) mark64="()(64bit)" ;;
|
|
|
|
esac
|
|
|
|
|
2001-06-02 03:27:33 +08:00
|
|
|
#
|
|
|
|
# --- Executable sonames.
|
1997-09-01 23:55:56 +08:00
|
|
|
for f in $exelist; do
|
2001-06-02 03:27:33 +08:00
|
|
|
[ -r $f -a -x $f ] || continue
|
|
|
|
lib64=`if file -L $f 2>/dev/null | \
|
2001-06-16 00:01:10 +08:00
|
|
|
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
|
2001-06-02 03:27:33 +08:00
|
|
|
ldd $f | awk '/=>/ {
|
|
|
|
if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/) {
|
|
|
|
gsub(/'\''"/,"\\&",$1);
|
|
|
|
printf "%s'$lib64'\n", $1
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
done | xargs -r -n 1 basename | sort -u
|
1996-11-22 06:16:00 +08:00
|
|
|
|
2001-06-02 03:27:33 +08:00
|
|
|
#
|
|
|
|
# --- Library sonames.
|
1998-04-02 00:02:05 +08:00
|
|
|
for f in $liblist; do
|
2001-06-02 03:27:33 +08:00
|
|
|
[ -r $f ] || continue
|
|
|
|
lib64=`if file -L $f 2>/dev/null | \
|
2001-06-16 00:01:10 +08:00
|
|
|
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
|
2001-06-02 03:27:33 +08:00
|
|
|
ldd $f | awk '/=>/ {
|
|
|
|
if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/) {
|
|
|
|
gsub(/'\''"/,"\\&",$1);
|
|
|
|
printf "%s'$lib64'\n", $1
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
done | xargs -r -n 1 basename | sort -u
|
1998-04-02 00:02:05 +08:00
|
|
|
|
2001-06-02 03:27:33 +08:00
|
|
|
#
|
|
|
|
# --- Script interpreters.
|
1997-09-01 23:55:56 +08:00
|
|
|
for f in $scriptlist; do
|
2001-06-02 03:27:33 +08:00
|
|
|
[ -r $f -a -x $f ] || continue
|
|
|
|
interp=`head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1`
|
|
|
|
interplist="$interplist $interp"
|
|
|
|
case $interp in
|
|
|
|
*/perl) perllist="$perllist $f" ;;
|
2001-06-06 03:26:22 +08:00
|
|
|
*) [ "${f%.pm}" != "${f}" ] && perllist="$perllist $f" ;;
|
2001-06-02 03:27:33 +08:00
|
|
|
esac
|
|
|
|
done
|
2001-06-16 00:01:10 +08:00
|
|
|
[ -n "$interplist" ] && { echo "$interplist" | tr [:blank:] \\n | sort -u ; }
|
1999-02-16 02:26:09 +08:00
|
|
|
|
2001-06-02 03:27:33 +08:00
|
|
|
#
|
|
|
|
# --- Weak symbol versions (from glibc).
|
1999-02-16 02:26:09 +08:00
|
|
|
for f in $liblist $exelist ; do
|
2001-06-02 03:27:33 +08:00
|
|
|
[ -r $f ] || continue
|
|
|
|
lib64=`if file -L $f 2>/dev/null | \
|
2001-06-16 00:01:10 +08:00
|
|
|
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
|
1999-02-16 02:26:09 +08:00
|
|
|
objdump -p $f | awk '
|
|
|
|
BEGIN { START=0; LIBNAME=""; }
|
|
|
|
/Version References:/ { START=1; }
|
|
|
|
/required from/ && (START==1) {
|
|
|
|
sub(/:/, "", $3);
|
|
|
|
LIBNAME=$3;
|
|
|
|
}
|
2001-06-02 03:27:33 +08:00
|
|
|
(START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) {
|
|
|
|
print LIBNAME "(" $4 ")'$lib64'";
|
|
|
|
}
|
1999-02-16 02:26:09 +08:00
|
|
|
/^$/ { START=0; }
|
|
|
|
'
|
1999-06-18 04:18:08 +08:00
|
|
|
done | sort -u
|
2001-06-02 03:27:33 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# --- Perl modules.
|
|
|
|
[ -x /usr/lib/rpm/perl.req -a -n "$perllist" ] && \
|
|
|
|
echo $perllist | tr [:blank:] \\n | /usr/lib/rpm/perl.req | sort -u
|
|
|
|
|
|
|
|
#
|
|
|
|
# --- Python modules.
|
|
|
|
[ -x /usr/lib/rpm/python.req -a -n "$pythonlist" ] && \
|
|
|
|
echo $pythonlist | tr [:blank:] \\n | /usr/lib/rpm/python.req | sort -u
|
|
|
|
|
|
|
|
#
|
|
|
|
# --- Tcl modules.
|
|
|
|
[ -x /usr/lib/rpm/tcl.req -a -n "$tcllist" ] && \
|
|
|
|
echo $tcllist | tr [:blank:] \\n | /usr/lib/rpm/tcl.req | sort -u
|
2001-06-16 05:52:47 +08:00
|
|
|
|
|
|
|
exit 0
|