#! /bin/sh

bindir=`dirname $0`
bindir=`cd $bindir;pwd`

progname=`basename $0 | sed s/^arc// | sed s/^ng//`

if [ -z "$GLOBUS_LOCATION" ] ; then
    if [ -e /etc/sysconfig/globus ] ; then
        . /etc/sysconfig/globus
    fi
    if [ -z "$GLOBUS_LOCATION" ] ; then
        GLOBUS_LOCATION=/opt/globus
    fi
fi

export GLOBUS_LOCATION

if [ -e "$GLOBUS_LOCATION/etc/globus-user-env.sh" ] ; then
    . "$GLOBUS_LOCATION/etc/globus-user-env.sh"
else
    echo "Can not find GLOBUS_LOCATION"
    exit 1
fi

# Assume bindir is just below prefix
ARC_LOCATION=`dirname $bindir`
export ARC_LOCATION

export LD_LIBRARY_PATH=$ARC_LOCATION/`basename $bindir`/../lib:$LD_LIBRARY_PATH

$bindir/arccli $progname "$@"
