#!/bin/bash
EG_HOME=/opt/egurkha
export EG_HOME
CLASSPATH=$EG_HOME/lib/eg_agent.jar:$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]: " > /dev/tty
read data
if [ "$data" = "n" ]
then
	exit 0
fi
echo "Are you configuring the web adapter capability for an Apache or IBM web server y/n? [y]: " > /dev/tty
read data
if [ "$data" = "n" ]
then
	echo "Sorry! This web server type is not supported ..." 
	exit 0
fi
choice=1
echo "Are you the administrator of this web server? y/n [y]: "
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: "
	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"
else
	/opt/egurkha/bin/conf_webadapter $choice 
fi
echo " "
