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