#!/bin/sh
# Copyright (c) 1994 by Adobe Systems Incorporated.
# Script called immediately after a package is installed.
# $1=Install directory for package. $2=License data file
########################################################

# First we move directory X to Photoshop.MacFiles
/usr/bin/mv $1/X $1/Photoshop.MacFiles

# Modify launch script with the information about install directory
/usr/bin/cat $1/bin/photoshop \
| sed 's%INSTALL_DIR=$%INSTALL_DIR="'$1'"%' \
> $1/bin/photoshop.new
/usr/bin/rm -f $1/bin/photoshop
/usr/bin/mv $1/bin/photoshop.new $1/bin/photoshop
chmod 555 $1/bin/photoshop


# Copy FLEXlm utility programs to the default location.
if [ ! -d /usr/local/flexlm ] ; then
	if /usr/bin/mkdir -p /usr/local/flexlm ; then status=0; else status=1; fi
	if [ $status != 0 ]; then
		echo ""
		echo "Could not create directory /usr/local/flexlm."
		echo "Easy/quick installation was unsuccessful."
		echo "Re-install following the longer custom installation instructions."
		echo ""
		exit 1
	fi
fi
if [ ! -w /usr/local/flexlm ] ; then
	echo ""
	echo "Cannot write to directory /usr/local/flexlm."
	echo "Easy/quick installation was unsuccessful."
	echo "Re-install following the longer custom installation instructions."
	echo ""
	exit 1
fi
if /usr/bin/cp -p -r $1/flexlm/* /usr/local/flexlm ; then status=0; else status=1; fi
if [ $status != 0 ]; then
	echo ""
	echo "Copy operation failed for FLEXlm license utilities."
	echo "Easy/quick installation was unsuccessful."
	echo "Re-install following the longer custom installation instructions."
	echo ""
	exit 1
fi
if $1/desktop/deskinstall ; then status=0; else status=1; fi
if [ $status != 0 ]; then
	echo ""
	echo "Integration of Photoshop onto the desktop failed."
	echo ""
fi

# Change owner and group for root & sys repectively
echo "Changing ownerships..."
chown -R root $1; chgrp -R 0 $1
exit 0
