Alexander Larsson e394c7
#!/bin/bash
Alexander Larsson e394c7
#
Alexander Larsson e394c7
# mono-find-provides
Alexander Larsson e394c7
#
Alexander Larsson e394c7
# Authors:
Alexander Larsson e394c7
#       Ben Maurer (bmaurer@ximian.com)
Alexander Larsson e394c7
#
Alexander Larsson e394c7
# (C) 2005 Novell (http://www.novell.com)
Alexander Larsson e394c7
#
Alexander Larsson e394c7
# Args: builddir buildroot libdir
Alexander Larsson e394c7
Alexander Larsson e394c7
IFS=$'\n'
Alexander Larsson e394c7
filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
Alexander Larsson e394c7
monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)\$"))
Alexander Larsson e394c7
Alexander Larsson e394c7
# If monodis is in the package being installed, use that one
Alexander Larsson e394c7
# This is to support building mono
Alexander Larsson e394c7
build_bindir="$2/usr/bin"
Alexander Larsson e394c7
build_libdir="$2$3"
Alexander Larsson e394c7
Alexander Larsson e394c7
if [ -x $build_bindir/monodis ]; then
Alexander Larsson e394c7
    monodis="$build_bindir/monodis"
Alexander Larsson e394c7
    export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
Alexander Larsson e394c7
elif [ -x /usr/bin/monodis ]; then
Alexander Larsson e394c7
    monodis="/usr/bin/monodis"
Alexander Larsson e394c7
else
Alexander Larsson e394c7
    exit 0;
Alexander Larsson e394c7
fi
Alexander Larsson e394c7
Alexander Larsson e394c7
export MONO_SHARED_DIR=$1
Alexander Larsson e394c7
Alexander Larsson e394c7
for i in "${monolist[@]}"; do
Alexander Larsson e394c7
        ($monodis --assembly $i | awk '
Alexander Larsson e394c7
                BEGIN { LIBNAME=""; VERSION=""; }
Alexander Larsson e394c7
                /^Version:/ { VERSION=$2 }
Alexander Larsson e394c7
                /^Name:/    { LIBNAME=$2 }
Alexander Larsson e394c7
                END {
Alexander Larsson e394c7
                        if (VERSION && LIBNAME)
Alexander Larsson e394c7
                                print "mono(" LIBNAME ") = " VERSION
Alexander Larsson e394c7
                }
Alexander Larsson e394c7
            ') 2>/dev/null
Alexander Larsson e394c7
done