#!/usr/bin/env bash
#
# Copyright 2005-2008 VMware, Inc.  All rights reserved.
#
# Wrapper for a binary. Ensure that the binary will find all the
# shared libraries it needs. If a shared library is not available from
# any of the standard system-wide locations, we provide it from the
# location where the VMware software is installed.
#
# The binary must have the same name in BINDIR as it does in LIBDIR/bin.
#

set -e

ROOT_REQUIRED=no

ETCDIR=/etc/vmware
. $ETCDIR/bootstrap

export PRODUCT_NAME="VMware VProbes"
libdir="$LIBDIR"/vmware

uid=`id -u` || exit 1

if [ "$ROOT_REQUIRED" = "yes" -a $uid -ne 0 ]; then
   "$BINDIR"/vmware-gksu "$0" "$@"
else
   binary="`basename "$0"`"
   exec "$libdir"/bin/"$binary" "$@"
fi

exit 1
