Blame SOURCES/find-requires

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