a008c1
#!/bin/bash
a008c1
a008c1
#
a008c1
# Auto-generate requirements for executables (both ELF and a.out) and library
a008c1
# sonames, script interpreters, and perl modules.
a008c1
#
a008c1
a008c1
ulimit -c 0
a008c1
a008c1
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
a008c1
a008c1
[ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] && \
a008c1
    echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --requires
a008c1
a008c1
#
a008c1
# --- Kernel module imported symbols
a008c1
#
a008c1
# Since we don't (yet) get passed the name of the package being built, we
a008c1
# cheat a little here by looking first for a kernel, then for a kmod.
a008c1
#
a008c1
a008c1
unset is_kmod
a008c1
a008c1
for f in $filelist; do
a008c1
    if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*)\.ko(\.gz|\.bz2|\.xz)?$:\2:p') ]
a008c1
    then
a008c1
        is_kmod=1;
a008c1
    elif [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ]
a008c1
    then
a008c1
	unset is_kmod;
a008c1
	break;
a008c1
    fi
a008c1
done
a008c1
a008c1
[ -x /usr/lib/rpm/redhat/find-requires.ksyms ] && [ "$is_kmod" ] &&
a008c1
    printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires.ksyms
a008c1
a008c1
exit 0