Blame SOURCES/find-provides

7b79ae
#!/bin/bash
7b79ae
7b79ae
# This script reads filenames from STDIN and outputs any relevant provides
7b79ae
# information that needs to be included in the package.
7b79ae
7b79ae
if [ "$1" ]
7b79ae
then
7b79ae
   package_name="$1"
7b79ae
fi
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 --provides
7b79ae
7b79ae
#
7b79ae
# --- any other extra find-provides scripts
7b79ae
for i in /usr/lib/rpm/redhat/find-provides.d/*.prov
7b79ae
do
7b79ae
    [ -x $i ] &&
7b79ae
        (echo $filelist | tr '[:blank:]' \\n | $i | sort -u)
7b79ae
done
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
is_kmod=1
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_kernel=1;
7b79ae
    fi
7b79ae
    if [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ]
7b79ae
    then
7b79ae
	unset is_kmod;
7b79ae
    fi
7b79ae
done
7b79ae
if [ ! "$is_kernel" ] || [ "$package_name" == "kernel" ]
7b79ae
then
7b79ae
    unset is_kmod
7b79ae
fi
7b79ae
7b79ae
[ -x /usr/lib/rpm/redhat/find-provides.ksyms ] && [ "$is_kmod" ] &&
7b79ae
    printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-provides.ksyms
7b79ae
7b79ae
exit 0