#!/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 (unused)
########################################################

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

if [ -r /bin/uname ] ; then
	osname=`/bin/uname -s`
	# 64 bit IRIX6 returns IRIX64 for uname -s
	firstfour=`echo "$osname" | sed -e 's/^\(....\).*$/\1/g'`
	if [ "$firstfour" = "IRIX" ] ; then
		osname="IRIX"
	fi
	if [ "$osname" = "SunOS" ] ; then
		if $1/desktop/olwm.deskinstall ; then status=0; else status=1; fi
		if [ $status != 0 ]; then
			echo ""
			echo "Integration onto the desktop failed."
			echo ""
		fi
	elif [ "$osname" = "IRIX" ] ; then
		if $1/desktop/deskinstall ; then status=0; else status=1; fi
		if [ $status != 0 ]; then
			echo ""
			echo "Integration of TypeInstaller onto the desktop failed."
			echo "Easy/quick installation was unsuccessful."
			echo "Re-install following the longer custom installation instructions."
			echo ""
			exit 1
		fi
	fi
fi

# Remove this script
/usr/bin/rm $1/installscripts/postinstall $1/installscripts/postinstallq

exit 0
