#!/bin/sh
#Tag 0x00FF02C0
# Version: Adobe Photoshop 3.0.1
# Copyright (c) 1993-1995 by Adobe Systems Incorporated.
#
# Shell script for launching Photoshop.
#
# This script accepts command line parameters in the form:
#    -e xxx=yyy
# where "xxx" is a shell variable name and "yyy" is the value.
# For each parameter that follows -e, this script does an eval on the parameter.
# The following shell variables are reasonable candidates for setting on the 
# command line (see comments below for a description of these variables):
#    LM_LICENSE_FILE
#    PHOTOSHOP_ROOT
#    PHOTOSHOP_VERSION
#    PHOTOSHOP_BUILD
#    PHOTOSHOP_SUPPRESS_WARNINGS
# Example: photoshop -e LM_LICENSE_FILE=/usr/local/flexlm/licenses/license.dat
###################################################################

# Make sure Berkeley stuff and X stuff is on user's path so hostname can be found.
PATH=$PATH:/usr/ucb:/usr/bsd:/usr/bin/X11:/usr/openwin/bin
export PATH

defIFS="$IFS"
export defIFS	# XXX: why is this exported?

AWK="/usr/bin/awk"
CP="/usr/bin/cp"
LN="/usr/bin/ln"
LS=/usr/bin/ls
MKDIR="/usr/bin/mkdir -p"
MV="/usr/bin/mv"
RM="/usr/bin/rm"
SED="/usr/bin/sed"
UNAME=/usr/bin/uname
PKGINFO="/usr/bin/pkginfo"

SYSTEMDIR=".system"
EXECNAME="AdobePhotoshop3.0.1"
SHIPDIR=AdobePhotoshop_3.0.1

# Number of processors on this CPU
nprocessors=1

ORIG_LICENSE_FILE="$LM_LICENSE_FILE"
LM_LICENSE_FILE=""

#
#	function to make a shadow tree
# 
#	two cases:
#		1.  want to put the copy in a subdir of the second arg
#		2.  want to put the copy in a dir whose name is the 2nd arg
#
#	if the second arg doesn't exist, case 2.  if it exists, case 1
#
# usage: cptree <srcdir> <destdir>
#
cptree()	#  <srcdir> <destdir>
{
	# get full path name of source directory.  but check first
	# if source directory is already an absolute path name

	case "$1" in
	
		\/*)	sourcedir="$1"
			;;
	
		*)	sourcedir=`(cd "$1"; pwd)`
			;;
	
	esac
	
	case $2 in
	
		\/*)	destdir="$2"
			;;
	
		*)	destdir="`pwd`/$2"
			;;
	
	esac
	
	droot="$destdir"

	#
	# set t to the trailing dir component of $sourcedir
	#
	t=`echo "$sourcedir" | sed 's%.*\/\([^/]*\)$%\1%'`
	
	if [ -d "$droot" ] ; then
		# case 1
		droot="$droot/$t"
	fi
	
	mkdir "$droot" 2> /dev/null
	
	$INSTALL_DIR/bin/lndir -silent "$sourcedir" "$droot" 2> /dev/null
}

################################################################################
#
#	this only gets executed on solaris machines.
#
verify_sx_patches()
{
	# Check for proper patches if running SunOS 5.3.
	if [ "$osminor" -eq 3 ] ; then

	        # Check for patches 101594-15 or greater.
	        patch_101594_15=0
	        patchnum=0
	        for value in $SYSTEM_PATCHES; do
        		if [ $patchnum = 0 ] ; then
				patchnum=$value
			else
				rev=$value
				if [ "$patchnum" -eq 101594 -a "$rev" -ge 15 ] ; then
					patch_101594_15=1
				fi
				patchnum=0
			fi
		done

		if [ $patch_101594_15 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 101594-15 (or greater) is not installed on this system'
				echo 'and is recommended for Photoshop to work properly.'
				echo "Refer to Installation Guide and README for more details."
			fi
		fi
	fi
}

################################################################################
#
#	this only gets executed on solaris machines.
#
verify_mp_patches()
{
	# Check for proper chip if running SunOS 5.3.
	if [ "$CHIPVERSION" = SPARCV7 ] ; then
		if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
			echo ""
			echo "Warning: environment variable PHOTOSHOP_MPCHARGED is true,"
			echo "but this machine is an older Sparc and does not support this feature."
			echo "PHOTOSHOP_MPCHARGED will be ignored."
		fi
		PHOTOSHOP_MPCHARGED=false

		return

	fi
}

################################################################################
#
#	this only gets executed on solaris machines.
#
verify_sx_and_mp_patches()
{

	if [ -x "$INSTALL_DIR/bin/sxmemory" ] ; then
		# If any SX memory allocated via sxconfig, print a warning.
		sxmemory=`$INSTALL_DIR/bin/sxmemory`
		if [ "$sxmemory" -gt 0 ] ; then
			echo ""
			echo "Warning: SX memory is allocated on your system."
			echo "This version of Photoshop will not use allocated SX memory."
			echo "To free up allocated SX memory:"
			echo "  1. Become superuser/root"
			echo "  2. /usr/kvm/sxconfig -d"
			echo "  3. Reboot"
		fi
	fi


	if [ -r /dev/sx0 ] ; then

		verify_sx_patches

	fi

	if [ "$PHOTOSHOP_MPCHARGED" = true ] ; then

		verify_mp_patches

	fi

}

################################################################################
#
#	verify patches not related to the sx and mp patches.
#
#	this only gets executed on solaris machines.
#
verify_other_solaris_patches()
{
	if [ "$osminor" -eq 3 ] ; then

		patch_101362_40=0
		patch_101318_74=0
		patch_101409_04=0
		patch_102110_01=0
		patchnum=0

		for value in $SYSTEM_PATCHES; do
			if [ $patchnum = 0 ] ; then
				patchnum=$value
			else
				rev=$value
				if [ "$patchnum" -eq 101362 -a "$rev" -ge 40 ] ; then
					patch_101362_40=1
				fi
				if [ "$patchnum" -eq 101318 -a "$rev" -ge 74 ] ; then
					patch_101318_74=1
				fi
				if [ "$patchnum" -eq 101409 -a "$rev" -ge 4 ] ; then
					patch_101409_04=1
				fi
				if [ "$patchnum" -eq 102110 -a "$rev" -ge 1 ] ; then
					patch_102110_01=1
				fi
				patchnum=0
			fi
		done

		if [ $patch_101362_40 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 101362-40 (or greater) is not installed on this system.'
				echo 'This patch prevents the X server from crashing on operations where'
				echo 'windows resize (e.g., Image Resize) and Photoshop from hanging on'
				echo 'certain other operations (e.g., Acquire EPS, text).'
				echo 'Refer to Installation Guide and README for more details.'
			fi
		fi

		if [ $patch_101318_74 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 101318-74 (or greater) is not installed on this system.'
				echo 'Refer to Installation Guide and README for more details.'
				echo ""
			fi
		fi

		if [ $patch_101409_04 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 101409-04 (or greater) is not installed on this system.'
				echo 'Refer to Installation Guide and README for more details.'
				echo ""
			fi
		fi

		if [ $patch_102110_01 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 102110-01 (or greater) is not installed on this system.'
				echo 'Refer to Installation Guide and README for more details.'
				echo ""
			fi
		fi
	fi

	if [ "$osminor" -eq 4 ] ; then

		patch_101922_10=0
		patch_101945_27=0
		patch_102057_14=0
		patch_102224_04=0
		patchnum=0

		for value in $SYSTEM_PATCHES; do
			if [ $patchnum = 0 ] ; then
				patchnum=$value
			else
				rev=$value
				if [ "$patchnum" -eq 101922 -a "$rev" -ge 10 ] ; then
					patch_101922_10=1
				fi
				if [ "$patchnum" -eq 101945 -a "$rev" -ge 27 ] ; then
					patch_101945_27=1
				fi
				if [ "$patchnum" -eq 102057 -a "$rev" -ge 14 ] ; then
					patch_102057_14=1
				fi
				if [ "$patchnum" -eq 102224 -a "$rev" -ge 4 ] ; then
					patch_102224_04=1
				fi
				patchnum=0
			fi
		done

		if [ $patch_101922_10 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 101922-10 (or greater) is not installed on this system.'
				echo 'Refer to Installation Guide and README for more details.'
				echo ""
			fi
		fi

		if [ $patch_101945_27 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 101945-27 (or greater) is not installed on this system.'
				echo 'Refer to Installation Guide and README for more details.'
				echo ""
			fi
		fi

		if [ $patch_102057_14 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 102057-14 (or greater) is not installed on this system.'
				echo 'This patch prevents the X server from crashing on operations where'
				echo 'windows resize (e.g., Image Resize) and Photoshop from hanging on'
				echo 'certain other operations (e.g., Acquire EPS, text).'
				echo 'Refer to Installation Guide and README for more details.'
			fi
		fi

		if [ $patch_102224_04 = 0 ] ; then
			if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
				echo ""
				echo 'Warning: patch 102224-04 (or greater) is not installed on this system.'
				echo 'Refer to Installation Guide and README for more details.'
				echo ""
			fi
		fi

	fi
	if [ -f /etc/rc2.d/S50flexlm -a -f /etc/rc3.d/S50flexlm ] ; then
		if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
			echo ""
			echo "Warning: There are two S50flexlm files on this system,"
			echo "/etc/rc2.d/S50flexlm and /etc/rc3.d/S50flexlm."
			echo "This may result in the wrong FLEXlm daemons being launched."
			echo "It is recommended that you consolidate the two files"
			echo "into /etc/rc3.d/S50flexlm."
		fi
	fi
}

verify_irix_system_configuration()
{
	# Check if user has recommended amount of swap and give warning if vswap is on
	if /sbin/chkconfig vswap ; then
		if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
			echo ""
			echo "Warning: You have the virtual swap mechanism turned on. This can"
			echo "cause memory intensive applications such as Photoshop to crash"
			echo "randomly under low memory situations. We recommend that you"
			echo "turn off this feature and add more physical swap if needed."
			echo "If you are using other applications that absolutely require"
			echo "that vswap is on, then at least make sure that you have"
			echo "lots of physical swap space available."
			echo ""
			echo "For more information about risks with virtual swap, see the"
			echo "LOGICAL SWAP SPACE section in swap(1M) man pages."
			echo ""
			echo "To turn off virtual swap, first quit Photoshop and then"
			echo "do the following:"
			echo "       su root"
			echo "       /etc/chkconfig vswap off"
			echo "       /etc/reboot"
			echo ""
		fi
	fi

	# Now compute the total physical swap space allocated by user in 512 byte blocks
	swaptot=`/etc/swap -nlb | grep -v "# path" | awk '{ s += $4} END {print s}'`

	# Recommend a minimum of 80 Meg (163840 blocks) swap
	if [ $swaptot -le 163839 ] ; then 
		if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
			echo ""
			echo "Warning: You do not have sufficient physical swap space. This"
			echo "can cause Photoshop to run out of memory when trying to do"
			echo "memory intensive operations. To assure that Photoshop has"
			echo "enough memory, we recommend that you have at least 80 megabytes"
			echo "of physical swap space allocated."
			echo ""
			echo "For more information on how to add physical swap space, see"
			echo "the swap(1M) man pages or refer to the System Administration"
			echo "section of the Adobe Photoshop Installation Guide."
			echo ""
		fi
	fi
}

verify_solaris_system_configuration()
{
	case "$PHOTOSHOP_SUPPRESS_PATCHCHECK" in
	"")
		verify_sx_and_mp_patches
		verify_other_solaris_patches
		;;
	esac
}

verify_system_configuration()
{
	if [ "$osname" = "IRIX" ] ; then
		verify_irix_system_configuration
	fi

	if [ "$osname" = "SunOS" -a "$osmajor" -gt 4 ] ; then
		verify_solaris_system_configuration
	fi

	# Check for licensing files in default locations.
	# If present and look suspicious, print warnings.
	if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
		if [ -f "$s50flexlm_file" ] ; then
			checketc=`grep '^LMGRD_DIR' "$s50flexlm_file" | grep $flexlm24_dirstring`
			if [ "$checketc" != "" ] ; then
				echo ""
				echo "Warning: Your $s50flexlm_file file appears to be pointing to an older"
				echo "version of lmgrd than is required by Photoshop."
				echo "You might need to replace '$flexlm24_dirstring' with '$flexlm40_dirstring'."
				echo "Please review the licensing instructions in the Installation Guide."
			fi
		fi
		if [ -f /usr/local/flexlm/licenses/license.dat ] ; then
			checklicense=`grep '^DAEMON ADBED' /usr/local/flexlm/licenses/license.dat | grep $flexlm24_dirstring`
			if [ "$checklicense" != "" ] ; then
				echo ""
				echo "Warning: Your /usr/local/flexlm/licenses/license.dat file appears to be pointing to an older"
				echo "version of ADBED than is required by Photoshop."
				echo "You might need to replace '$flexlm24_dirstring' with '$flexlm40_dirstring'."
				echo "Please review the licensing instructions in the Installation Guide."
			fi
		fi
	fi
}

# <INSTALL_DIR> holds the directory into which the product
# was installed (e.g., /usr/adobe/Photoshop_3.0.1).
# This script computes the value of INSTALL_DIR as follows:
#	1) If environment variable PHOTOSHOP_HOME has a value, then that is used.
#	2) Otherwise, try to determine it automatically by determining the
#		location of this launch script and using its parent directory.
#		If file <parent directory>/<executable> exists, then assume
#		we have determined the parent directory correctly.
INSTALL_DIR=
if [ "$PHOTOSHOP_HOME" != "" ] ; then
	INSTALL_DIR="$PHOTOSHOP_HOME"
else
	# Try to determine automatically the parent directory to this launch script.
	thisscriptname=$0

	# Follow any symbolic links in thisscriptname.
	while : ; do
		lsresult=`$LS -l $thisscriptname`
		symlink=`expr "$lsresult" : '.*>'.*`

		if [ "$symlink" -gt 0 ] ; then
			oldscriptname="$thisscriptname"
			thisscriptname=`echo $lsresult | sed -e 's/^.*-> *\(.*\) *$/\1/g'`
			abspath_new=`expr "$thisscriptname" : '^/'`
			if [ $abspath_new != 1 ] ; then
				abspath_old=`expr "$oldscriptname" : '^/'`
				if [ $abspath_old != 1 ] ; then
					olddir=`pwd`
				else
					olddir=`expr "$oldscriptname" : '\(.*\)/'`
				fi
				thisscriptname="$olddir/$thisscriptname"
			fi
		else
			break
		fi
	done

	# Determine directory containing this shell script.
	scriptdir=`expr $thisscriptname : '\(.*\)/'` 
	if [ "$scriptdir" = "" -o "$scriptdir" = "." ] ; then
		scriptdir=`pwd`
	fi

	# Determine root directory for installation ($scriptdir/..).
	parentdir=`expr $scriptdir : '\(.*\)/'` 

	if [ -f "$parentdir/lib/%$EXECNAME" ]; then
		INSTALL_DIR="$parentdir"
	fi
fi
export INSTALL_DIR

# <LM_LICENSE_FILE> is the file containing the license keys for this app.
# If this front-end shell script does not properly set the value of this
# environment variable or the license file does not contain appropriate license
# keys, the product will print an error message at start-up and will not run.
# This launch script gives first priority to the LM_LICENSE_FILE value
# the is passed on the command line via "-e LM_LICENSE_FILE=xxx".
# Second priority goes to the inherited vale of LM_LICENSE_FILE
# environment variable. Thirdly, this launch script first looks for the file of the name
# $INSTALL_DIR/custom/LM_LICENSE_FILE and looks for a line in this file
# of the form "LM_LICENSE_FILE=xxx" (must start in column 1)
# and sets environment variable LM_LICENSE_FILE to xxx.
# If licensing is not working properly, it may because this file is missing
# or has an incorrect value. If so, edit this file with a text editor.
# Alternatively, you can override the value of LM_LICENSE_FILE by launching
# this script with '-e LM_LICENSE_FILE=xxx' command line arguments.
export LM_LICENSE_FILE
if [ -f "$INSTALL_DIR/custom/LM_LICENSE_FILE" ] ; then
	CUSTOM_LICENSE_FILE=`grep '^LM_LICENSE_FILE' "$INSTALL_DIR/custom/LM_LICENSE_FILE"  | sed -e 's/^LM_LICENSE_FILE= *\([^ ]\)/\1/'`
fi

# <SITE_PSRESOURCEPATH> is a list of directories containing
# site-specific PostScript resources (such as fonts) that might
# be useful to this application.
# This launch script first looks for a file of the name
# $INSTALL_DIR/custom/SITE_PSRESOURCEPATH and looks for a line in this file
# of the form "SITE_PSRESOURCEPATH=xxx" (must start in column 1)
# and sets environment variable SITE_PSRESOURCEPATH to xxx.
# If this application does not find it PostScript resources properly, it could
# be that this file is missing or has an incorrect value.
# If so, edit this file with a text editor.
# Alternatively, you can override the value of SITE_PSRESOURCEPATH by launching
# this script with '-e SITE_PSRESOURCEPATH=xxx' command line arguments.
# Finally, if $INSTALL_DIR/custom/SITE_PSRESOURCEPATH does not have a valid
# entry and if no '-e SITE_PSRESOURCEPATH=xxx' option is given, then this
# script will use the value of SITE_PSRESOURCEPATH that was inherited from the
# user's current environment.
if [ -f "$INSTALL_DIR/custom/SITE_PSRESOURCEPATH" ] ; then
	site_path=`grep '^SITE_PSRESOURCEPATH' "$INSTALL_DIR/custom/SITE_PSRESOURCEPATH"  | sed -e 's/^SITE_PSRESOURCEPATH= *\([^ ]\)/\1/'`
	if [ "$site_path" != "" ] ; then
		eval SITE_PSRESOURCEPATH="$site_path"
	fi
fi

# Make sure that the directories listed in SITE_PSRESOURCEPATH
# are included within the user's PSRESOURCEPATH environment variable.
# Insert these directories into where :: appears in PSRESOURCEPATH.
if [ "$SITE_PSRESOURCEPATH" != "" ] ; then
    export PSRESOURCEPATH
    if [ "$PSRESOURCEPATH" = "" ] ; then
        PSRESOURCEPATH="$SITE_PSRESOURCEPATH::"
    else
        PSRESOURCEPATH=`echo $PSRESOURCEPATH | /usr/bin/sed "s^::^:$SITE_PSRESOURCEPATH::^"`
    fi
    # Replace triple colons with double colons.
    PSRESOURCEPATH=`echo $PSRESOURCEPATH | /usr/bin/sed "s/:::/::/g"`
fi

# Make sure DISPLAY variable has a value
export DISPLAY
case "$DISPLAY" in
"") DISPLAY=":0" ;;
:*) ;;
local:*) ;;
unix:*) ;;
*)
    # If DISPLAY environment variable is of form <hostname>:0 and <hostname>
    # matches the name of this host, then strip off <hostname> to prevent
    # network accesses.
    hostname="$UNAME -n"
    for f in /usr/bin/hostname /usr/ucb/hostname /usr/bsd/hostname
    do
	if [ -x $f ] ; then
	    hostname=$f
	    break
	fi
    done
    HOST=`$hostname`
    case "$DISPLAY" in
    $HOST:*)
	DISPLAY=`expr "$DISPLAY" '.*\(:.*\)'`
	;;
    esac
    ;;
esac

# Set which version of Photoshop we should run.
DEFAULT_VERSION="3.0.1"
if [ "$PHOTOSHOP_VERSION" = "" ] ; then
	PHOTOSHOP_VERSION="$DEFAULT_VERSION"
fi
DEFAULT_BUILD="d43"
if [ "$PHOTOSHOP_BUILD" = "" ] ; then
	PHOTOSHOP_BUILD="$DEFAULT_BUILD"
fi

# Determine the OS/productversion/CHIP/GUI
# appropriate for the current user based on the computer
# he is currently logged into.
MACHINE="UNKNOWN"
osname="UNKNOWN"
osversion="UNKNOWN"
osmajor="UNKNOWN"
osminor="UNKNOWN"
if [ -r $UNAME ] ; then
    osname=`$UNAME -s`
    osversion=`$UNAME -r`
    check=`echo "$osversion" | egrep '^[0-9]\.[0-9]*'`
    if [ "$check" != "" ]
    then
        osmajor=`echo "$osversion" | sed -e 's/^\([0-9][0-9]*\).*/\1/'`
        osminor=`echo "$osversion" | sed -e 's/^[0-9]\.\([0-9][0-9]*\).*/\1/'`
    else
        osversion="UNKNOWN"
    fi

    # 64 bit IRIX6 returns IRIX64 for uname -s
    case "$osname" in
    IRIX*) osname=IRIX ;;
    esac
fi

error=0

case "$osname" in
SunOS)
	if [ -r /usr/bin/sparc ] && /usr/bin/sparc ; then
		MACHINE="sparc"
	else
		echo "$productname requires a SPARC system$bell"
		exit 1
	fi

	case "osversion" in
	UNKNOWN|[0-4].*|5.[012]*)
		echo "$productname requires Solaris 2.3 or greater$bell"
		exit 1
		;;
	esac

	SPARCVIS=n
	karch=`$UNAME -m`
	case "$karch" in
	sun4) sparcversion=7 ;;
	sun4c) sparcversion=7 ;;
	sun4d) sparcversion=8 ;;
	sun4m)
		for HOSTID in /usr/ucb/hostid /usr/bin/hostid
		do
			if [ -x $HOSTID ] ; then
				host=`$HOSTID`
				break
			fi
		done
		case "$host" in
		# Sun-4/600, may have Ross CPU
		71*)
			if \
				for PRTCONF in \
					/etc/prtconf \
					/usr/sbin/prtconf \
					/usr/etc/devinfo
				do
					if [ -x $PRTCONF ] ; then
						$PRTCONF -vp
						break
					fi
				done |
				egrep -s >/dev/null 'sparc-version: *0*7$'
			then
				sparcversion=7
			fi
			;;
		esac
		sparcversion=8
		;;
	sun4u) SPARCVIS=y sparcversion=8 ;;
	*) sparcversion=9 ;;
	esac

	# Launch different binaries depending on type of Sparc processor.
	if [ $sparcversion -gt 7 ] ; then
		CHIPVERSION="SPARCV8"
	else
		CHIPVERSION="SPARCV7"
	fi
	PHOTOSHOP_CHIPVERSION="$CHIPVERSION"
	export PHOTOSHOP_CHIPVERSION

	# Determine number of processors.
	if [ -x /usr/sbin/psrinfo ] ; then
		nprocessors=`/usr/sbin/psrinfo | fgrep -c 'on-line'`
	fi
	;;

IRIX)
    # SGI machines: we only support IRIX 5.3/6.2
    if [ -r /bin/mips ] && /bin/mips
    then
        MACHINE="mips"
        cpu=`hinv | awk '/^[ 	]*CPU:/ { print substr($3, 1, 2) }'`
	case "$cpu" in
	R3)
            echo $productname is not available for R3000 machines$bell.
            error=1
	    ;;
	R2)
            echo $productname is not available for R2000 machines$bell.
            error=1
	    ;;
	*)
	    PHOTOSHOP_CHIPVERSION="R4000"
	    export PHOTOSHOP_CHIPVERSION
	    ;;
        esac

	if [ "$osmajor" = "6" ] && [ "$osminor" -ge 2 ] ; then
		:
	elif [ "$osmajor" = "5" ] && [ "$osminor" -ge 3 ] ; then
		:
        else
            echo Invalid operating system version returned from 'uname -r': $osversion$bell.
            error=1
        fi
    else
        echo $productname is not available for your type of SGI machine$bell.
        error=1
    fi
    ;;
esac

if [ $error = 1 ] ; then
    exit 1
fi

# We have to warn the users when they try to lauch two Photoshops

# be sure $USER is set
: "${USER=${LOGNAME-`/usr/bin/logname`}}"

if [ `/usr/bin/ps -afu $USER|grep AdobePhotoshop3|grep -v grep|grep -v photoshop|wc -l` -gt 0 ] ; then
   if [ "$osname" = "IRIX" ] ; then
	# For SGI we post a confirm. Pass through args so that -display will work.
	# xconfirm ignores unused options from ${1+"$@"} magic.
   	result=`/usr/bin/X11/xconfirm -icon question \
		-t "Photoshop is already running. Running more than" \
		-t "one Photoshop may hang or produce bad effects." \
		-t "Do you want to continue ?" -B Quit -b Continue ${1+"$@"}`
	if [ "$result" = "Quit" ] ; then
		exit 1
	fi
   else
   	# We warn the SUN user
	echo ""
	echo "WARNING: Photoshop is already running. Running more than" 
	echo "         one Photoshop may hang or produce bad effects."
   fi
fi

# <DFT_PHOTOSHOP_ROOT> is the directory relative to $HOME which mirrors
# directory structure of <INSTALL_DIR>. Not used for local installations.
if [ "$DFT_PHOTOSHOP_ROOT" = "" ] ; then
    DFT_PHOTOSHOP_ROOT="$HOME/AdobePhotoshop3"
fi

# Set up system dependent variable values.
case "$osname" in
IRIX)
    LD_LIBRARY_PATH="$INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
    export LD_LIBRARY_PATH
    s50flexlm_dir=/etc/rc2.d/S50flexlm
    flexlm24_dirstring=sgi/v5
    flexlm40_dirstring=v4.0/sgi_u5
    ;;
SunOS)
    if [ "$OPENWINHOME" = "" ] ; then
        export OPENWINHOME
        OPENWINHOME=/usr/openwin
    fi
    PATH="$PATH:$OPENWINHOME/bin"

    # This was for Direct Xlib, which is no longer implemented,
    # so it should no longer be needed.
    #
    #XILHOME=/opt/SUNWits/Graphics-sw/xil
    #export XILHOME
    #if [ "$LD_LIBRARY_PATH" = "" ] ; then
    #    LD_LIBRARY_PATH=$XILHOME/lib:$OPENWINHOME/lib
    #else
    #    # We need to get direct XLIB stuff correctly, so insert
    #    # $OPENWINHOME/lib before user's LD_LIBRARY_PATH
    #    LD_LIBRARY_PATH=$XILHOME/lib:$OPENWINHOME/lib:$LD_LIBRARY_PATH
    #fi

    # Set the LD_LIBRARY_PATH so that we can use the latest Motif shared libs on
    # Solaris 2.3 but let user's choice and /usr/dt/lib (CDE Motif) take precedence
    # on Solaris 2.4 and above.
    test -d /usr/dt/lib && cdelib=/usr/dt/lib:
    LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$cdelib$INSTALL_DIR/lib:$OPENWINHOME/lib"

    export LD_LIBRARY_PATH

    s50flexlm_file=/etc/rc3.d/S50flexlm
    flexlm24_dirstring=sun4/sunOS5
    flexlm40_dirstring=v4.0/sun4_u5
    ;;
esac

# Process command line parameters.
while [ $# -gt 0 ] ; do
    # "-e" allows particular values from this script
    # to be overwritten from the command line.
    # For example, -e LM_LICENSE_FILE=/usr/local/licenses
    if [ "$1" = "-e" ] ; then
        shift
        eval "$1"
        shift
    else
        break
    fi
done

# At this stage, if LM_LICENSE_FILE has a value, it came from "-e LM_LICENSE_FILE".
# ORIG_LICENSE_FILE holds value of LM_LICENSE_FILE when launch script was invoked.
# CUSTOM_LICENSE_FILE holds contents from <installdir>/custom/LM_LICENSE_FILE.
# 
# Set LM_LICENSE_FILE to be the union of these three settings.
if [ "$LM_LICENSE_FILE" != "" ] ; then
	if [ "$ORIG_LICENSE_FILE" != "" ] ; then
		LM_LICENSE_FILE="$LM_LICENSE_FILE:$ORIG_LICENSE_FILE"
	fi
else
	LM_LICENSE_FILE="$ORIG_LICENSE_FILE"
fi
if [ "$LM_LICENSE_FILE" != "" ] ; then
	if [ "$CUSTOM_LICENSE_FILE" != "" ] ; then
		LM_LICENSE_FILE="$LM_LICENSE_FILE:$CUSTOM_LICENSE_FILE"
	fi
else
	LM_LICENSE_FILE="$CUSTOM_LICENSE_FILE"
fi

# Set PHOTOSHOP_ROOT if not provided already by user.
# For shared installations, use DFT_PHOTOSHOP_ROOT to set PHOTOSHOP_ROOT.
# Otherwise, set PHOTOSHOP_ROOT to INSTALL_DIR.
if [ "$PHOTOSHOP_ROOT" = "" ] ; then
	PHOTOSHOP_ROOT="$DFT_PHOTOSHOP_ROOT"
fi

# If things are installed properly, PHOTOSHOP_ROOT should be different
# from INSTALL_DIR.
if [ "$PHOTOSHOP_ROOT" = "$INSTALL_DIR" ] ; then
    echo ""
    echo "Incorrect settings for PHOTOSHOP_ROOT and INSTALL_DIR."
    echo "They are both set to: $PHOTOSHOP_ROOT."
    echo "Unable to launch $0."
    echo ""
    exit 1
fi

# Determine whether to turn on VISCharged plug-in.
if [ "$osname" = SunOS ] ; then
    case $PHOTOSHOP_VISCHARGED in
    true|True|TRUE|Yes|yes|YES|1|y|Y)
        PHOTOSHOP_VISCHARGED=true
        ;;
    false|False|FALSE|No|no|NO|0+n|N)
        PHOTOSHOP_VISCHARGED=false
        ;;
    *)
        if [ "$PHOTOSHOP_VISCHARGED" = "" ] ; then
            PHOTOSHOP_VISCHARGED=false
            if [ $SPARCVIS = y ] ; then
                PHOTOSHOP_VISCHARGED=true
            fi
        else
            echo ""
            echo "PHOTOSHOP_VISCHARGED has an invalid value. Must be true or false. False assumed."
            PHOTOSHOP_VISCHARGED=false
        fi
        ;;
    esac
fi
# If we can't find the VISCharged plug-in, set PHOTOSHOP_VISCHARGED to false.
if [ ! -f "$INSTALL_DIR/$SHIPDIR/Plug-ins/Extensions/VISCharged" ] ; then
	PHOTOSHOP_VISCHARGED=false
fi

# Determine whether to turn on MPCharged plug-in.
case $PHOTOSHOP_MPCHARGED in
true|True|TRUE|Yes|yes|YES|1|y|Y)
    PHOTOSHOP_MPCHARGED=true
    ;;
false|False|FALSE|No|no|NO|0+n|N)
    PHOTOSHOP_MPCHARGED=false
    ;;
*)
    if [ "$PHOTOSHOP_MPCHARGED" = "" ] ; then
        if [ "$osname" = SunOS ] ; then
            PHOTOSHOP_MPCHARGED=false
            if [ "$nprocessors" -gt 1 ] ; then
                # If any more than one processor, turn on MPCharged plug-in
                PHOTOSHOP_MPCHARGED=true
            fi
        elif [ "$osname" = IRIX ] ; then
            if [ -f "$INSTALL_DIR/$SHIPDIR/Plug-ins/Extensions/MPChargeSuite" ] ; then
                PHOTOSHOP_MPCHARGED=true
            else
                PHOTOSHOP_MPCHARGED=false
            fi
        fi
    else
        echo ""
        echo "PHOTOSHOP_MPCHARGED has an invalid value. Must be true or false. False assumed."
        PHOTOSHOP_MPCHARGED=false
    fi
    ;;
esac

SYSTEM_PATCHES=""
if [ "$osname" = SunOS -a "$osmajor" -eq 5 -a "$osminor" -le 4 ] ; then
	# Patches will end up with '<patchnum> <rev> <patchnum> <rev>...'
	SYSTEM_PATCHES=`/usr/bin/showrev -p | /usr/bin/awk '{ print $2; }' | /usr/bin/sed 's/-/ /g' | /usr/bin/tr '\012' ' '`
fi

verify_system_configuration

# Ensure that user has appropriate directories and symbolic
# links in $HOME/AdobePhotoshop to real Photoshop install.
if [ ! -d "$PHOTOSHOP_ROOT" ] ; then
    ${MKDIR} "$PHOTOSHOP_ROOT"
fi

# Check file which indicates last version user has run.
if [ -f "$PHOTOSHOP_ROOT/.photoshop_version" ] ; then
    version=`cat $PHOTOSHOP_ROOT/.photoshop_version`
else
    version=""
fi
targetversion="Photoshop_"$PHOTOSHOP_VERSION$PHOTOSHOP_BUILD"_"$OS"_"$MACHINE"_$INSTALL_DIR"

# environment variable to suppress root directory munging
case "$PHOTOSHOP_SUPPRESS_ROOTCHECK" in
?*) version="$targetversion" ;;
esac

# Create new links only if previous installation does not match the new one
if [ "$version" != "$targetversion" ]; then
 
	${RM} -f "$PHOTOSHOP_ROOT/.photoshop_version"
	echo "$targetversion" > "$PHOTOSHOP_ROOT/.photoshop_version"

	#create directories for Fonts, Scratch
	if [ ! -d "$PHOTOSHOP_ROOT/$SYSTEMDIR/System/Temporary Items" ] ; then
		${MKDIR} "$PHOTOSHOP_ROOT/$SYSTEMDIR/System/Temporary Items"
	fi
	if [ ! -d "$PHOTOSHOP_ROOT/$SYSTEMDIR/System/Fonts" ] ; then
		${MKDIR} "$PHOTOSHOP_ROOT/$SYSTEMDIR/System/Fonts"
	fi

	# Clean up the Fonts directory and relink system fonts.
	rm -fr "$PHOTOSHOP_ROOT/$SYSTEMDIR/System/Fonts"
	cptree "$INSTALL_DIR/$SHIPDIR/$SYSTEMDIR/System/Fonts" "$PHOTOSHOP_ROOT/$SYSTEMDIR/System"

	# link Photoshop and System resource files
	${RM} -f "$PHOTOSHOP_ROOT/$SYSTEMDIR/System/%System"
	${LN} -s "$INSTALL_DIR/$SHIPDIR/$SYSTEMDIR/System/%System" "$PHOTOSHOP_ROOT/$SYSTEMDIR/System/%System"

	${RM} -f "$PHOTOSHOP_ROOT/$SYSTEMDIR/%$EXECNAME"
	${LN} -s "$INSTALL_DIR/lib/%$EXECNAME" "$PHOTOSHOP_ROOT/$SYSTEMDIR/%$EXECNAME"

	# Link Photoshop executable
	${RM} -f "$PHOTOSHOP_ROOT/$SYSTEMDIR/$EXECNAME"
	if [ "$osname" = "IRIX" ] ; then
		${LN} -s "$INSTALL_DIR/lib/$EXECNAME" "$PHOTOSHOP_ROOT/$SYSTEMDIR/$EXECNAME"
	else
		# Link the Photoshop executable for SUN with every launch (v7 or v8)
		${LN} -s "$INSTALL_DIR/lib/$EXECNAME"-"$CHIPVERSION" "$PHOTOSHOP_ROOT/$SYSTEMDIR/$EXECNAME"
	fi

	# Create a Goodies directory and subordinate files and subdirectories.
	if [ -d "$PHOTOSHOP_ROOT/Goodies" ] ; then
		rm -fr "$PHOTOSHOP_ROOT/Goodies"
	fi
	cptree "$INSTALL_DIR/$SHIPDIR/Goodies" "$PHOTOSHOP_ROOT"

	# Create a Plug-ins directory and subordinate files and subdirectories.
	if [ -d "$PHOTOSHOP_ROOT/Plug-ins" ] ; then
		# tiptoe around the Third_Party directory.
		rm -fr "$PHOTOSHOP_ROOT/Plug-ins/Displacement_maps
		rm -fr "$PHOTOSHOP_ROOT/Plug-ins/Filters
		rm -fr "$PHOTOSHOP_ROOT/Plug-ins/Extensions
		rm -fr "$PHOTOSHOP_ROOT/Plug-ins/Parser
		rm -fr "$PHOTOSHOP_ROOT/Plug-ins/Acquire_Export
		rm -fr "$PHOTOSHOP_ROOT/Plug-ins/File_Format
	fi
	cptree "$INSTALL_DIR/$SHIPDIR/Plug-ins" "$PHOTOSHOP_ROOT"

	# Create a Preferences directory.
	prefsdir="Preferences"
	if [ ! -d "$PHOTOSHOP_ROOT/$prefsdir" ] ; then
		${MKDIR} "$PHOTOSHOP_ROOT/$prefsdir"
	fi

	# Link Keyboard preferences files
	if [ -d "$PHOTOSHOP_ROOT/Preferences/Keyboards" ] ; then
		rm -fr "$PHOTOSHOP_ROOT/Preferences/Keyboards"
	fi
	cptree	"$INSTALL_DIR/$SHIPDIR/Preferences/Keyboards"	\
		"$PHOTOSHOP_ROOT/Preferences"

	# ... but we need real copies of a default kbd file.
	for d in Sparc SGI SGI-PS2
	do
		${RM} -f "$PHOTOSHOP_ROOT/Preferences/Keyboards/$d/Default Keyboard"
		${RM} -f "$PHOTOSHOP_ROOT/Preferences/Keyboards/$d/%Default Keyboard"

		cp	"$INSTALL_DIR/$SHIPDIR/Preferences/Keyboards/$d/Default Keyboard"	\
			"$INSTALL_DIR/$SHIPDIR/Preferences/Keyboards/$d/%Default Keyboard"	\
			"$PHOTOSHOP_ROOT/Preferences/Keyboards/$d"
	done

	# Create a Tutorial directory and the files within it.
	if [ -d "$PHOTOSHOP_ROOT/Tutorial" ] ; then
		rm -fr "$PHOTOSHOP_ROOT/Tutorial"
	fi
	# we have to copy the Tutorial files as real files, not links.
	( cd "$INSTALL_DIR/$SHIPDIR" ; tar cf - Tutorial | (cd "$PHOTOSHOP_ROOT"; tar xf - ))

	# Create a procsets directory and the files within it.
	if [ -d "$PHOTOSHOP_ROOT/procsets" ] ; then
		rm -fr "$PHOTOSHOP_ROOT/procsets"
	fi
	cptree "$INSTALL_DIR/$SHIPDIR/procsets" "$PHOTOSHOP_ROOT"

	# Create a bin directory and the files within it.
	if [ -d "$PHOTOSHOP_ROOT/bin" ] ; then
		rm -fr "$PHOTOSHOP_ROOT/bin"
	fi
	cptree "$INSTALL_DIR/bin" "$PHOTOSHOP_ROOT"

	# Create a doc directory and the files within it.
	if [ -d "$PHOTOSHOP_ROOT/doc" ] ; then
		rm -fr "$PHOTOSHOP_ROOT/doc"
	fi
	cptree "$INSTALL_DIR/doc" "$PHOTOSHOP_ROOT"

	# link README file to PHOTOSHOP_ROOT
	file="README"
	${RM} -f "$PHOTOSHOP_ROOT/$file"
	${LN} -s "$INSTALL_DIR/$file" "$PHOTOSHOP_ROOT/$file"

	IFS="$defIFS"
else

	# redo the third-party plugins directory if our plugins directory is
	# called "Plug-ins"
	if [ -d "$PHOTOSHOP_ROOT/Plug-ins" ] ; then
		cptree "$INSTALL_DIR/$SHIPDIR/Plug-ins/Third_Party" "$PHOTOSHOP_ROOT/Plug-ins"
	fi

fi

# If PHOTOSHOP_DEFAULT_FS is set, set QUORUM_DEFAULT_FS to the value of
# PHOTOSHOP_DEFAULT_FS.
case "$PHOTOSHOP_DEFAULT_FS" in
AD|ad|APPLEDOUBLE|appledouble|AppleDouble|NFSShare|NFSshare|NFSSHARE|nfsshare)
    QUORUM_DEFAULT_FS="AD"
    ;;
ETHERSHARE|EtherShare|Ethershare|ethershare|Helios|HELIOS|helios)
    QUORUM_DEFAULT_FS="ETHERSHARE"
    ;;
K-ASHARE|K-AShare|KASHARE|KAShare|kashare|Xinet|XINET|xinet)
    QUORUM_DEFAULT_FS="K-ASHARE"
    ;;
PARTNER|Partner|partner|IPT|ipt)
    QUORUM_DEFAULT_FS="PARTNER"
    ;;
*)
    if [ "$PHOTOSHOP_DEFAULT_FS" != "" ] ; then
        echo ""
        echo "PHOTOSHOP_DEFAULT_FS has an invalid value: $PHOTOSHOP_DEFAULT_FS."
        echo "Valid default file system types are AD, ETHERSHARE, K-ASHARE and PARTNER."
        echo "Will set PHOTOSHOP_DEFAULT_FS to AD (Apple Double)."
    fi
    QUORUM_DEFAULT_FS="AD"
    ;;
esac
PHOTOSHOP_DEFAULT_FS=$QUORUM_DEFAULT_FS
export QUORUM_DEFAULT_FS
export PHOTOSHOP_DEFAULT_FS

# Set QUORUM_AD_START_DATE variable based on PHOTOSHOP_AD_START_DATE. This is
# to give users a choice to work around a bug in Intercon's NFS/Share. AppleDouble
# standard published by Apple says that the date info resource should be an offset
# from Jan 1, 2000, but Intercon writes it in format based on Jan 1, 1904. User's
# can set this variable to 2000 or 1904, the default value is 2000. This will write
# date info resource based on user's choice so transferring them to Mac using
# NFS/Share will yield correct date.
if [ "$PHOTOSHOP_AD_START_DATE" != "" ]; then
    if [ "$PHOTOSHOP_AD_START_DATE" != "2000" -a "$PHOTOSHOP_AD_START_DATE" != "1904" ]; then
        echo ""
        echo "PHOTOSHOP_AD_START_DATE has an invalid value: $PHOTOSHOP_AD_START_DATE."
        echo "Valid default appledouble start dates are 2000 and 1904."
        echo "Will use default value of PHOTOSHOP_AD_START_DATE = 2000."
    else
	export QUORUM_AD_START_DATE
	QUORUM_AD_START_DATE="$PHOTOSHOP_AD_START_DATE"
    fi
fi

# Set XUSERFILESEARCHPATH and/or XFILESEARCHPATH so that Photoshop can
# find its resource file.
#
# 1. If the user doesn't have an XFILESEARCHPATH or an XUSERFILESEARCHPATH,
#    we set XUSERFILESEARCHPATH so we don't have to worry about the default
#    XFILESEARCHPATH.
#
# 2. If the user has XUSERFILESEARCHPATH set but not XFILESEARCHPATH, we
#    set XFILESEARCHPATH to our directory plus our best guess at the
#    default path
#
# 3. If the user already has an XFILESEARCHPATH, we just prepend our directory.
#
MYFILESEARCHPATH="$INSTALL_DIR/app-defaults/%N%S"
case "$XFILESEARCHPATH" in
"")
	case "$XUSERFILESEARCHPATH$XAPPLRESDIR" in
	"")
		XUSERFILESEARCHPATH="$MYFILESEARCHPATH"
		export XUSERFILESEARCHPATH
		;;
	*)
		case "$osname" in
		IRIX) X11=/usr/lib/X11 ;;
		SunOS) X11=/usr/openwin/lib ;;
		*) X11=/usr/lib/X11 ;;
		esac
		XFILESEARCHPATH="$MYFILESEARCHPATH"
		XFILESEARCHPATH="$XFILESEARCHPATH:$X11/%L/%T/%N%C%S:$X11/%l/%T/%N%C%S:$X11/%T/%N%C%S"
		XFILESEARCHPATH="$XFILESEARCHPATH:$X11/%L/%T/%N%S:$X11/%l/%T/%N%S:$X11/%T/%N%S"
		export XFILESEARCHPATH
		;;
	esac
	;;
	
*)
	XFILESEARCHPATH="$MYFILESEARCHPATH:$XFILESEARCHPATH"
	export XFILESEARCHPATH
	;;
esac

# Set the PHOTOSHOP_SERVER_FONTS to just look for Adobe Type 1 scalable fonts
export PHOTOSHOP_SERVER_FONTS
if [ "$PHOTOSHOP_SERVER_FONTS" = "" ] ; then
    PHOTOSHOP_SERVER_FONTS='none'
fi

# Check for bad F3 upr file
if [ "$osname" = "SunOS" -a "$osmajor" -eq 5 -a "$osminor" -eq 3 ] ; then
    # Local and remote display
    if [ "$displayhost" = "" ] ; then
        cmp -s /usr/openwin/lib/X11/DPSF3Fonts.upr "$INSTALL_DIR/fixedF3upr/DPSF3Fonts.upr.bad"
        if [ "$?" = "0" ] ; then
            if [ "$PHOTOSHOP_SUPPRESS_WARNINGS" != true ] ; then
                echo ""
                echo "Warning: the version of /usr/openwin/lib/X11/DPSF3Fonts.upr that is"
                echo "on your system has a known problem which causes applications such"
                echo "as Photoshop to hang on start-up. Please do the following:"
                echo "       <become superuser>"
                echo "       cd /usr/openwin/lib/X11"
                echo "       mv -i DPSF3Fonts.upr DPSF3Fonts.upr.orig"
                echo "       cp -p $INSTALL_DIR/fixedF3upr/DPSF3Fonts.upr.good DPSF3Fonts.upr"
                echo "Then, restart your X server. See Installation Guide and README"
                echo "for details."
                echo ""
            fi
        fi
    fi
fi

# Remove/add links for SXCharged, VISCharged and MPCharged.

extsrc="$INSTALL_DIR/$SHIPDIR/Plug-ins/Extensions"
extdst="$PHOTOSHOP_ROOT/Plug-ins/Extensions"

if [ -d "$extdst" ] ; then
	$RM -f "$extdst"/MPCharge* "$extdst"/%MPCharge*
	$RM -f "$extdst"/SXCharged* "$extdst"/%SXCharged*
	$RM -f "$extdst"/VISCharged* "$extdst"/%VISCharged*

	case "$osname" in
	SunOS)
		if [ "$PHOTOSHOP_VISCHARGED" = true ] ; then
			$LN -s "$extsrc"/VISCharged "$extdst"/VISCharged
			$LN -s "$extsrc"/%VISCharged "$extdst"/%VISCharged
		fi
		if [ "$PHOTOSHOP_MPCHARGED" = true ] ; then
			$LN -s "$extsrc"/MPCharged-$CHIPVERSION "$extdst/MPCharged-$CHIPVERSION"
			$LN -s "$extsrc"/%MPCharged "$extdst"/%MPCharged
		fi
		;;
	IRIX)
		if [ "$PHOTOSHOP_MPCHARGED" = true ] ; then
			$LN -s "$extsrc"/MPChargeSuite "$extdst/MPChargeSuite"
			$LN -s "$extsrc"/%MPChargeSuite "$extdst"/%MPChargeSuite
		fi
		;;
	esac
fi

#######
# Set environment variables necessary for application to find
# all of the files it needs.
#######
#
# set t to the trailing dir component of $PHOTOSHOP_ROOT
#
t=`echo "$PHOTOSHOP_ROOT" | sed 's%.*\/\([^/]*\)$%\1%'`
PHOTOSHOP_APPL_FILE="$t:$SYSTEMDIR:AdobePhotoshop3.0.1"
PHOTOSHOP_PREFERENCES="$PHOTOSHOP_ROOT"
PHOTOSHOP_PATH="$PHOTOSHOP_ROOT/.system"
export PHOTOSHOP_APPL_FILE PHOTOSHOP_PREFERENCES PHOTOSHOP_PATH PHOTOSHOP_ROOT

if [ "$osname" = "IRIX" ] ; then
#   New addition to check whether user has accepted the license agreemnt
#   given by Adobe to run this application.  This is necessary on machines
#   that are bundled with Photoshop.

#   setup the directory for getting license text
    ADOBE_LICENSE_DIR=$INSTALL_DIR/doc
    export ADOBE_LICENSE_DIR

    $INSTALL_DIR/bin/adobeLicense photoshop "3.0.1" || exit
fi

#start the DPS NX agent.
$INSTALL_DIR/bin/execnx -sleep 0 -- -linger :10 2> /dev/null

# Execute the binary for the application.
# The incantation ${1+"$@"} is a Bourne shell idiom to pass args correctly,
# even if some args contain embedded spaces
case "$PHOTOSHOP_BINARY" in
"") PHOTOSHOP_BINARY="$PHOTOSHOP_ROOT/$SYSTEMDIR/$EXECNAME" ;;
esac

echo Launching Adobe Photoshop $PHOTOSHOP_VERSION \($PHOTOSHOP_BUILD\)
echo

"$PHOTOSHOP_BINARY" ${1+"$@"}
