#!/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	
# Modified by Joe Hoot
#	Modified to accomidate PHP Helpdesk instead of TWIG
#
# This script is made possible by the talented creaters listed above.

echo ""
echo "PHP Helpdesk Install Script"
echo "==========================="
echo ""

# Make sure the user specified a path to use.
if [ ! "$1" ]; then
   	echo "This shell script will install PHP Helpdesk(version .03 or greater)"
   	echo "in to a directory of your choice."
   	echo ""
   	echo "Usage: ./helpdesk_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
   	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 includes..."
cp -R includes $target_dir
echo "Installing images..."
cp -R images $target_dir
echo "Installing configuration files..."
cp -R config $target_dir
echo "Installing scripts..."
cp -R scripts $target_dir
echo "Installing language files..."
cp -R languages $target_dir
echo "Installing root files..."
cp index.php $target_dir
cp phphelpdesk.mysql $target_dir
cp COPYING $target_dir
cp README $target_dir
cp INSTALL $target_dir
cp UPGRADE $target_dir
echo ""
echo "YOU MUST NOW EDIT $target_dir/config/ FILES AND "
echo "PROCEED WITH CREATING THE DATABASE INFORMATION. "
echo "YOU NEED TO EDIT THE FOLLOWING FILES: "
echo ""
echo "$target_dir/config/general.conf.php"
echo "$target_dir/config/db.conf.php"
echo "$target_dir/config/loginform.conf.php"
echo "" 
echo "Then point your browser to your g_base_url that " 
echo "you put in general.conf.php" 
echo "Done!"
