#!/bin/sh

# This line will be automatically uncommented when you "make install"
installed=1

if [ -z $installed ] ; then
    echo "*** Running uninstalled beagle-search ***"
    THIS_EXE="./Search.exe"

    export LD_LIBRARY_PATH="../glue/.libs${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
    export MONO_PATH="../Util:../BeagleClient${MONO_PATH+:MONO_PATH}"
else
    THIS_EXE="/usr/lib64/beagle/Search.exe"

    export LD_LIBRARY_PATH="/usr/lib64/beagle${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
fi

if [ -z "$BEAGLE_MONO_RUNTIME" ]; then
   export BEAGLE_MONO_RUNTIME="mono"
else
   echo "*** Using mono runtime at $BEAGLE_MONO_RUNTIME ***"
fi

exec -a beagle-search $BEAGLE_MONO_RUNTIME $MONO_EXTRA_ARGS $THIS_EXE "$@"
