#!/bin/sh
# Script to launch the $PRODUCT installer

product=ArcExplorer

while getopts gc choice
do
	case $choice in
		g)  mode="-i gui";;
		c)  mode="-i console";;
		*)  echo "    "
                    echo "Usage: $0 [-c] [-g]"
                    echo "       -c: invoke the installer in console mode"
                    echo "       -g: invoke the installer in gui mode"
                    echo "    "
		    exit 1;;
	esac
done

if [ "$mode" = "" ] || [ "$mode" = "-i gui" ]
then
   # validate the current DISPLAY
   if [ -z "$DISPLAY" ]
   then
      echo "   "
      echo "WARNING:  This shell's DISPLAY variable has not been set."
      echo "A valid display is required to execute this setup in GUI"
      echo "mode. To execute in GUI mode, set the DISPLAY variable to"
      echo "your local UNIX host, or execute this setup from a UNIX"
      echo "host which has the DISPLAY variable set. To execute in"
      echo "console mode, run this script with a "-c" option."
      echo "   "
      exit 1
   fi
fi


# Determine the path to the CD root directory.
if test "`echo $0 | cut -c1`" = "/"
then
   FullCmnd=$0
elif test "`echo $0 | cut -c1-2`" = "./"
then
   FullCmnd="`pwd`/`echo $0 | cut -c3-`"
else
   FullCmnd="`pwd`/$0"
fi

# Set env var for CD root directory
CD_ROOT=`dirname $FullCmnd`; export CD_ROOT

case `uname` in
	Solaris) platform=Solaris;;
	SunOS)   platform=Solaris;;
	HP-UX)   platform=HPUX;;
	AIX)     platform=AIX;;
	Linux)   platform=Linux;;
	*)       echo "Unknown operating system." 1>&2; exit;;
esac

# Launch the setup
sh $CD_ROOT/$product/Disk1/InstData/NoVM/AEJava.bin $mode