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