7689d7
#!/bin/bash
7689d7
7689d7
# This script reads filenames from STDIN and outputs any relevant provides
7689d7
# information that needs to be included in the package.
7689d7
7689d7
if [ "$1" ]
7689d7
then
7689d7
   package_name="$1"
7689d7
fi
7689d7
7689d7
filelist=`sed "s/['\"]/\\\&/g"`
7689d7
7689d7
[ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] &&
7689d7
    echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --provides
7689d7
7689d7
#
7689d7
# --- any other extra find-provides scripts
7689d7
for i in /usr/lib/rpm/redhat/find-provides.d/*.prov
7689d7
do
7689d7
    [ -x $i ] &&
7689d7
        (echo $filelist | tr '[:blank:]' \\n | $i | sort -u)
7689d7
done
7689d7
7689d7
#
7689d7
# --- Kernel module imported symbols
7689d7
#
7689d7
# Since we don't (yet) get passed the name of the package being built, we
7689d7
# cheat a little here by looking first for a kernel, then for a kmod.
7689d7
#
7689d7
7689d7
is_kmod=1
7689d7
for f in $filelist; do
7689d7
    if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*)\.ko(\.gz|\.bz2|\.xz)?$:\2:p') ]
7689d7
    then
7689d7
        is_kernel=1;
7689d7
    fi
7689d7
    if [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ]
7689d7
    then
7689d7
	unset is_kmod;
7689d7
    fi
7689d7
done
7689d7
if [ ! "$is_kernel" ] || [ "$package_name" == "kernel" ]
7689d7
then
7689d7
    unset is_kmod
7689d7
fi
7689d7
7689d7
[ -x /usr/lib/rpm/redhat/find-provides.ksyms ] && [ "$is_kmod" ] &&
7689d7
    printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-provides.ksyms
7689d7
7689d7
exit 0