#!/bin/sh
EG_HOME=/opt/egurkha
export EG_HOME
CLASSPATH=$EG_HOME/lib/eg_agent.jar:$EG_HOME/lib/classes111.zip:$CLASSPATH
export CLASSPATH
clear
echo "Configuring the eG web adapter ..."
echo " "
echo "Note: Only a web server administrator has permissions to configure "
echo "      the eG web adapter capability for a web server."
echo " " 
echo "Do you want to continue  y/n? [y]: \c" > /dev/tty
read data
if [ "$data" = "n" ]
then
	exit 0
fi
echo "Choose the type of web server for which you want to add the web adapter capability:"
echo "[1] Apache web server"
echo "[2] SunONE/iPlanet web server" 
echo "[3] IBM HTTP server"
echo "Select the web server type by number: \c" > /dev/tty
read choice < /dev/tty

echo "Are you the administrator of this web server? y/n [y]: \c"
read accept
if [ -z "$accept" ]
then 
	accept=y
fi
if test  "$accept" != "y" ; 
then
	echo "Please enter the user name of the web server's administator: \c"
	read user
	if test -z "$user" 
	then
		echo "Sorry! Invalid user name..."
		exit;
        fi
	echo "Next, you will need to enter the web server administrator's password ..."	
	su - $user -c "/opt/egurkha/bin/conf_webadapter $choice $PATH $CLASSPATH"
else
	/opt/egurkha/bin/conf_webadapter $choice $PATH $CLASSPATH
fi
echo " "
