#!/bin/sh

#
#...The PalaceServer for UNIX template installation script.
#

#...Introduction text and license agreement information
echo
echo "*****************************************************************"
echo "Welcome to the PalaceServer 4.4.1 template installer, which will"
echo "guide you through the process of installing the PalaceServer template"
echo "for UNIX."
echo     

#...Ask the user where to install the palace template media files:
ROOT="/usr/local/palace/palace/media"
echo
echo "In what directory would you like to install the PalaceServer Template"
echo "media files?  It is usually installed into the directory that contains"
echo "your Palace files.  Press return to use the default location:"
echo
echo "	[$ROOT]"
read inputstring
if [ "$inputstring" ]
then
	ROOT=$inputstring
	ROOT=`echo $ROOT | sed -e's!/$!!'`
fi

echo ""
echo "The Template media files will be installed in directory"
echo
echo "	$ROOT"
echo ""

if [ ! -d ${ROOT} ]; then mkdir ${ROOT}; fi
cp -i *.gif ${ROOT}

#...Ask the user where to install the palace template pat file:
END_PATH=`echo $ROOT | awk -F/ '{print $NF}'`
TEMP_ROOT=`echo $ROOT | sed "s/$END_PATH//"`
ROOT=$TEMP_ROOT

ROOT="${ROOT}psdata"
echo
echo "In what directory would you like to install the PalaceServer Template"
echo "pat file?  Press return to use the default location:"
echo
echo "	[$ROOT]"
read inputstring
if [ "$inputstring" ]
then
	ROOT=$inputstring
	ROOT=`echo $ROOT | sed -e's!/$!!'`
fi

echo ""
echo "The Template pat file will be installed in directory"
echo
echo "	$ROOT"
echo ""
if [ ! -d ${ROOT} ]; then mkdir ${ROOT}; fi
cp -i *.pat ${ROOT}

echo
echo "You're done!"
echo
echo "To use this template, you use the roomsfile command to update"
echo "your pserver.prefs file with this new .pat file."
echo
echo "For example:"
echo
echo '    roomsfile "psdata/Beach.pat"'
echo 
echo

exit 0
