#!/bin/sh # # $Id: startapp,v 1.68 2000/08/23 19:11:14 beth Exp $ # # This script determines the operating system and hardware combination # and overlays itself with the correct binary for the desired program. # The program is determined from the name by which the script is invoked. APPLICATION=`basename $0` APP_ARGS= IDL_VERSION=5.4 ENVI_VERSION=3.4 LICENSE_NAME= INSTALL_DIR=/usr/local/rsi INS_TYPE=FREELOOK # Use tr in /bin or /usr/bin if available TR=tr if [ -x /usr/bin/tr ]; then TR=/usr/bin/tr fi PRODUCT=`echo $INS_TYPE | $TR '[A-Z]' '[a-z]'` if [ "$PRODUCT" = "envi" ]; then PROD_VERSION=$ENVI_VERSION fi if [ "$PRODUCT" != "idl" ]; then IDLDIRECTORY_VERS=${PRODUCT}_${PROD_VERSION}/idl_${IDL_VERSION} IDLDIRECTORY=${PRODUCT}/idl else IDLDIRECTORY_VERS=idl_${IDL_VERSION} IDLDIRECTORY=${PRODUCT}/idl fi # Some applications can be invoked with or without a version suffix. # Recognise the versioned ones and remove the version. case $APPLICATION in "idl_$IDL_VERSION") APPLICATION=idl;; "idlde_$IDL_VERSION") APPLICATION=idlde;; "idldeclient_$IDL_VERSION") APPLICATION=idldeclient;; "idlrpc_$IDL_VERSION") APPLICATION=idlrpc;; "idlhelp_$IDL_VERSION") APPLICATION=idlhelp;; "idldemo_$IDL_VERSION") APPLICATION=idldemo;; "rsilicense_$IDL_VERSION") APPLICATION=rsilicense;; "envihelp_$ENVI_VERSION") APPLICATION=envihelp;; esac if [ "$PRODUCT" = "envi" ]; then # Find the main ENVI directory if [ "$ENVI_DIR" = "" ]; then TMP_DIR=`echo $IDL_DIR | awk -F\/ '{for(i=1;i1)printf("%s","/"); printf("%s",$i); }printf("\n")}'` for DIR in $INSTALL_DIR/envi_$ENVI_VERSION $TMP_DIR /usr/local/rsi/envi_$ENVI_VERSION ../idl /usr/local/lib/envi /usr/local/envi /usr/local/bin/envi do if [ -d $DIR ]; then if [ -f $DIR/save/envi.sav ]; then ENVI_DIR=$DIR break fi fi done fi if [ "$ENVI_DIR" = "" ]; then echo "Unable to access $APPLICATION. You will have to define the ENVI_DIR environment variable to point at the main ENVI directory before it will work." exit 1 elif [ "$IDL_DIR" = "" ]; then IDL_DIR=$ENVI_DIR/idl_$IDL_VERSION fi fi # Find the main IDL directory if [ "$IDL_DIR" = "" ]; then for DIR in $INSTALL_DIR/$IDLDIRECTORY_VERS /usr/local/rsi/$IDLDIRECTORY_VERS . ./idl_$IDL_VERSION /usr/local/lib/$IDLDIRECTORY /usr/local/$IDLDIRECTORY /usr/local/bin/$IDLDIRECTORY do if [ -d $DIR ]; then if [ -f $DIR/resource/fonts/hersh1.chr ]; then IDL_DIR=$DIR break fi fi done fi if [ "$IDL_DIR" = "" ]; then echo "Unable to access $APPLICATION. You will have to define the IDL_DIR environment variable to point at the main IDL directory before it will work." exit 1 fi # If LM_LICENSE_FILE is not defined and one of the following exists # $IDL_DIR/../license/license.dat (license dir from base idl product) # $IDL_DIR/../../license/license.dat (license dir from bundled product) # then define LM_LICENSE_FILE. If file is not found, leave it unset. # If LM_LICENSE_FILE is already set, then respect that and leave it alone. if [ \( "$LM_LICENSE_FILE" = "" \) ] ; then if [ \( -f $IDL_DIR/../license/$LICENSE_NAME \) ] ; then # default location for standard IDL distribution LM_LICENSE_FILE=$IDL_DIR/../license/$LICENSE_NAME export LM_LICENSE_FILE elif [ \( -f $IDL_DIR/../../license/$LICENSE_NAME \) ] ; then # default location for standard bundled distribution (ENVI, ION, etc.) LM_LICENSE_FILE=$IDL_DIR/../../license/$LICENSE_NAME export LM_LICENSE_FILE fi fi # Look for a -32 argument. If seen, take note, but don't worry # about removing it (idl accepts it and ignores it, allowing this # script to be simpler). If a platform supports both 32 and 64-bit # versions of our application, the default is to take the 64-bit version. # However, -32 says to run the 32-bit version even on a 64-bit platform PREFER_32=0 for arg do if [ "$arg" = "-32" ]; then PREFER_32=1 fi done # Determine the operating system, hardware architecture, and os release # Make sure these agree with IDL's compiled in paths or online help # won't be found. OS= ARCH= OSVER= case `uname` in "SunOS") # Solaris OS="solaris" OSVER="2" BIN_ARCH=/usr/bin/arch if [ -x /usr/bin/arch ]; then BIN_ARCH=/usr/bin/arch elif [ -x /usr/ucb/arch ]; then BIN_ARCH=/usr/ucb/arch fi if [ `$BIN_ARCH` = i86pc ]; then ARCH=".x86" else # If the system is running the 64-bit SunOS kernel, a 64-bit # IDL is installed, and the user did not specify the -32 # command argument, then run the 64-bit version. Otherwise # the 32-bit version will work on all supported platforms. ARCH=".sparc" if [ \( $PREFER_32 = 0 \) -a \( -x /bin/isainfo \) \ -a \( -f $IDL_DIR/bin/bin.$OS${OSVER}.sparc64/$APPLICATION \) ]; then if [ `/bin/isainfo -b` = 64 ]; then ARCH=.sparc64 fi fi fi ;; "AIX") OS="ibm";; "HP-UX") OS="hp";; "IRIX") OS="sgi";; "IRIX6") OS="sgi";; "IRIX64") OS="sgi";; "OSF1") OS="alpha";; "Linux") OS="linux" ARCH=".x86" if [ -x /bin/arch ]; then if [ `/bin/arch` = alpha ]; then ARCH=.alpha if [ "$APPLICATION" = "rsilicense" ]; then echo "$APPLICATION: is not supported on this system architecture.Please contact technical support for a license." exit 1 elif [ \( "$APPLICATION" = "idlde" \) -o \( "$APPLICATION" = "idl" \) -o \( "$APPLICATION" = "idldeclient" \) -o \( "$APPLICATION" = "idlrpc" \) ]; then APP_ARGS=-genver fi fi fi ;; *) echo "$APPLICATION: Unable to recognize system architecture." exit 1 ;; esac # Add the bin directory to the library search path case $OS in "ibm") if [ "$LIBPATH" = "" ]; then LIBPATH="/lib:/usr/lib:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib" else LIBPATH="/lib:/usr/lib:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib:$LIBPATH" fi # Append the lib directory of oracle on if ORACLE_HOME set for Dataminer if [ "$ORACLE_HOME" != "" ]; then LIBPATH="$ORACLE_HOME/lib:$LIBPATH" fi # Append the lib directory of sybase on if Sybase set for Dataminer if [ "$SYBASE" != "" ]; then LIBPATH="$SYBASE/lib:$LIBPATH" fi export LIBPATH ;; "hp") if [ "$SHLIB_PATH" = "" ]; then SHLIB_PATH="/usr/lib/X11R6:/usr/lib/X11R5:/usr/lib/X11R4:/usr/lib/Motif1.2:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib" else SHLIB_PATH="/usr/lib/X11R6:/usr/lib/X11R5:/usr/lib/X11R4:/usr/lib/Motif1.2:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib:$SHLIB_PATH" fi # Append the lib directory of sybase on if Sybase set for Dataminer if [ "$SYBASE" != "" ]; then SHLIB_PATH="$SYBASE/lib:$SHLIB_PATH" fi # Append the lib directory of oracle on if ORACLE_HOME set for Dataminer if [ "$ORACLE_HOME" != "" ]; then SHLIB_PATH="$ORACLE_HOME/lib:$SHLIB_PATH" fi export SHLIB_PATH ;; "solaris") if [ "$LD_LIBRARY_PATH" = "" ]; then LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib:/usr/openwin/lib:/usr/dt/lib" else LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib:/usr/openwin/lib:/usr/dt/lib:$LD_LIBRARY_PATH" fi # Append the lib directory of sybase on if Sybase set for Dataminer if [ "$SYBASE" != "" ]; then LD_LIBRARY_PATH="$SYBASE/lib:$LD_LIBRARY_PATH" fi export LD_LIBRARY_PATH ;; "sgi") if [ "$LD_LIBRARYN32_PATH" = "" ]; then LD_LIBRARYN32_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib" else LD_LIBRARYN32_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$IDL_DIR/bin/bin.$OS$OSVER$ARCH/dm/lib:$LD_LIBRARYN32_PATH" fi # Append the lib directory of sybase on if Sybase set for Dataminer if [ "$SYBASE" != "" ]; then LD_LIBRARYN32_PATH="$SYBASE/lib:$LD_LIBRARYN32_PATH" fi # Append the lib directory of oracle on if ORACLE_HOME set for Dataminer # NOTE: The user must set Oracle N32 home. if [ "$ORACLE_N32_HOME" != "" ]; then LD_LIBRARYN32_PATH="$ORACLE_N32_HOME/lib32:$LD_LIBRARYN32_PATH" fi export LD_LIBRARYN32_PATH ;; *) if [ "$LD_LIBRARY_PATH" = "" ]; then LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH" else LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$LD_LIBRARY_PATH" fi export LD_LIBRARY_PATH ;; esac # Users Libraries if [ "$IDL_PATH" = "" ]; then IDL_PATH="" fi # Add the IDL bin directory to the path so that idlde will always find idl PATH=$IDL_DIR/bin:$PATH export PATH IDL_DIR IDL_PATH # HyperText help requires special setup # Set up environment variables for HyperHelp. HHHOME=$IDL_DIR/help HHPATH=$IDL_DIR/bin/bin.$OS$OSVER$ARCH XPPATH=$IDL_DIR/resource/xprinter if [ "$XLIBI18N_PATH" = "" ]; then XLIBI18N_PATH=$IDL_DIR/resource/X11/lib fi if [ "$XFILESEARCHPATH" = "" ]; then XFILESEARCHPATH=$IDL_DIR/resource/X11/lib/app-defaults/%N%S:$IDL_DIR/resource/X11/lib/app-defaults/%T/%N%S else XFILESEARCHPATH="$IDL_DIR/resource/X11/lib/app-defaults/%N%S:$IDL_DIR/resource/X11/lib/app-defaults/%T/%N%S:$XFILESEARCHPATH" fi export HHHOME HHPATH XPPATH XLIBI18N_PATH XFILESEARCHPATH if [ "$APPLICATION" = "idlhelp" ]; then APP_ARGS=$IDL_DIR/help/idl.hlp fi if [ "$APPLICATION" = "envihelp" ]; then APPLICATION=idlhelp APP_ARGS=$ENVI_DIR/help/envi.hlp fi exec $IDL_DIR/bin/bin.$OS$OSVER$ARCH/$APPLICATION $* $APP_ARGS # We shouldn't get here unless there was an error. echo "$APPLICATION is not availible for this system ($OS$ARCH)" exit 1