#!/bin/sh
#
# Action						Date
# ===================================================== =================
# Created by Greg Ross					Long, long ago...
# Modifed by Kendrick Vargas				Oct.  6, 1999
# 	Script cleaned up to add checks n' stuff
# Modifed by Greg Ross 					Nov. 14, 1999
#	Additional verbage and status messages	
#

echo ""
echo "TWIG Install Script"
echo "==================="
echo ""

# Make sure the user specified a path to use.
if [ ! "$1" ]; then
   	echo "This shell script will install TWIG (version 2.0 or greater)"
   	echo "in to a directory of your choice."
   	echo ""
   	echo "Usage: ./twig_install /path/to/installation"
   	echo ""

   	exit
else
   	target_dir=$1
fi

# Check to make sure we can use the specified directory
if [ ! -d $target_dir ]; then
   	mkdir $target_dir >/dev/null 2>&1
   	if [ ! $? = 0 ]; then
      		echo "Error: could not create $target_dir."
      		exit
   	fi
 	elif [ ! -w $target_dir ]; then
   		echo "Error: Insufficant rights on $target_dir."
   		exit
	fi

# Everything checks out... go forward with the install
echo "Installing feature modules..."
cp -R features $target_dir
echo "Installing images..."
cp -R images $target_dir
echo "Installing configuration files..."
cp -R config $target_dir
echo "Installing library modules..."
cp -R lib $target_dir
echo "Installing root files..."
cp index.php3 $target_dir
cp test.php3 $target_dir
cp goto.php3 $target_dir
echo "Done!"
echo ""
