#!/bin/sh
if [ $# -eq 0 ]; then
	echo	=======================================================================
	echo	Brikx installer script
	echo -n	"Please type installation directory, or press ENTER to use /usr/share: "
	read DIR
	if [ "x$DIR" = "x" ]; then
		DIR="/usr/share";
	fi
else
	DIR=$1;
fi
echo	Installing to $DIR/brikx
mkdir $DIR/brikx
cp -R src/data $DIR/brikx
cp src/brikx $DIR/brikx
chmod 777 $DIR/brikx/data/high
echo "#!/bin/sh" >$DIR/../bin/brikx
echo "cd $DIR/brikx && ./brikx" >>$DIR/../bin/brikx
chmod 755 $DIR/../bin/brikx && echo "Installation complete, type 'brikx' to start playing"
chmod 755 $DIR/../bin/brikx || echo "\n\nERROR! Are you logged in as root?\n"
