Blame SOURCES/libguestfs-find-requires.sh

022f11
#!/bin/bash -
022f11
# Additional custom requires for libguestfs package.
022f11
#
022f11
# Note this script is *ONLY* applicable to Fedora 17+ (ie. with UsrMove)
022f11
# since we now assume that /usr/lib{,64} and /lib{,64} are the same
022f11
# directory and hence that:
022f11
#
022f11
#   Requires: libfoo.so.1           <=>  /usr/lib/libfoo.so.1 exists
022f11
#   Requires: libfoo.so.1()(64bit)  <=>  /usr/lib64/libfoo.so.1 exists
022f11
022f11
original_find_requires="$1"
022f11
shift
022f11
022f11
# Get the list of files.
022f11
files=`sed "s/['\"]/\\\&/g"`
022f11
022f11
# Use ordinary find-requires first.
022f11
echo $files | tr [:blank:] '\n' | $original_find_requires
022f11
022f11
# Is supermin.d/hostfiles included in the list of files?
022f11
hostfiles=`echo $files | tr [:blank:] '\n' | grep 'supermin\.d/hostfiles$'`
022f11
022f11
if [ -z "$hostfiles" ]; then
022f11
    exit 0
022f11
fi
022f11
022f11
# Generate extra requires for libraries listed in hostfiles.
022f11
sofiles=`grep 'lib.*\.so\.' $hostfiles | fgrep -v '*'`
022f11
for f in $sofiles; do
022f11
    if [ -f "$f" ]; then
022f11
        if [[ "$f" =~ (/usr)?/lib64/([^/]*)$ ]]; then
022f11
            echo "${BASH_REMATCH[2]}()(64bit)"
022f11
        elif [[ "$f" =~ (/usr)?/lib/([^/]*)$ ]]; then
022f11
            echo "${BASH_REMATCH[2]}"
022f11
        else
022f11
            echo "$f"
022f11
        fi
022f11
    fi
022f11
done