#!/afs/athena.mit.edu/project/gnu/bin/bash

RELOCDIR=~/.abuse
ABUSELIB=/afs/athena.mit.edu/contrib/games/arch/@sys/lib/abuse
ABUSEBIN=/afs/athena.mit.edu/contrib/games/arch/@sys/lib/abuse/bin
ABUSEEXEC=abuse.x11R6

if [ ! -d $RELOCDIR ] ; then
	echo
	echo "Abuse needs to create some files within your home"
	echo "directory in order to run.  These files will be"
	echo "created in \"$RELOCDIR\"."
	echo "Any saved games will be saved in this directory."
	echo
	echo -n "Do you want to have this directory created? [y/n] "
	read response
	echo
	if [ _"$response" = _y -o "_$response" = _yes ] ; then
		echo -n "Ok.  Proceeding..."
	else
		echo "As you wish.  No such directory created."
		echo
		exit
	fi
	# Go ahead and create the symlinks
	mkdir $RELOCDIR
	cd $RELOCDIR
	ln -s $ABUSELIB/abuse.doc $ABUSELIB/abuse.lsp $ABUSELIB/addon .
	ln -s $ABUSELIB/art $ABUSELIB/gamedev.txt $ABUSELIB/levels .
	ln -s $ABUSELIB/license.txt $ABUSELIB/light.tbl $ABUSELIB/lisp .
	ln -s $ABUSELIB/sfx .
	cp $ABUSELIB/options.lsp .
	echo "Done"
	echo
fi

echo "Starting ABUSE..."

export PATH=$ABUSEBIN:$PATH
cd $RELOCDIR

$ABUSEEXEC $*
