#
# Copyright 1998 Xi Graphics
#
# $XiGId: request,v 1.1 1998/03/03 16:54:43 jon Exp $
#
# arg 1 is the REQUEST_DATA file passed to the other installation scripts
#  for this package
#
###########################################################################

RCATSET=2	# the message set number we're using for this script
RCATFILE="ACCELX.cat"	# catalog file for this package

MCATFILE="$(FindCatalog $PKGLOCDIR $RCATFILE)"

ACCELXDIR=/usr/X11R6/lib/X11/AcceleratedX
XACCELINI=/etc/Xaccel.ini

## see if this product is already installed, if not, see if there
##  is a XACCELINI or an ACCELXDIR.  If so, do something sensible...

if ! IsProdInstalled "$PRODUCT_INST_NAME"
then    # not installed

	## first, lets check XACCELINI

	FILETXT="$(MessageFileCatSet $MCATFILE $RCATSET 3 'file')"
	DIRTXT="$(MessageFileCatSet $MCATFILE $RCATSET 4 'directory')"

	if [ -e $XACCELINI ]
	then # it be there..

		title="$(MessageFileCatSet $MCATFILE $RCATSET 1 '%s found' $XACCELINI)"
		msg="$(MessageFileCatSet $MCATFILE $RCATSET 2 '\n\nA %s %s has been found, which is incompatible with \nthis release of the Accelerated-X Server, and must be removed.\n\n Do you wish to remove this %s and continue with \ninstallation?' $XACCELINI $FILETXT $FILETXT)"

		if YesNoBox "$title" "$msg"
		then
			# go ahead and remove it, and continue
			Log "$0: Removing $XACCELINI..."
			$RM -f $XACCELINI
		else	# chicken...
			exit 1
		fi
	fi

	## now for ACCELXDIR
	
	if [ -e $ACCELXDIR ]
	then	# it's there
		title="$(MessageFileCatSet $MCATFILE $RCATSET 1 '%s found' $ACCELXDIR)"
		msg="$(MessageFileCatSet $MCATFILE $RCATSET 2 '\n\nA %s %s has been found, which is incompatible with \nthis release of the Accelerated-X Server, and must be removed.\n\n Do you wish to remove this %s and continue with \ninstallation?' $ACCELXDIR $DIRTXT $DIRTXT)"
	
		if YesNoBox "$title" "$msg"
		then
			# wipe the puppy out
			# but be careful
			if [ ! -z "$ACCELXDIR" ]
			then 
				Log "$0: Removing $ACCELXDIR..."
				$RM -rf $ACCELXDIR
			fi
		else
			exit 1
		fi
	fi
fi

exit 0
	

