#! /bin/csh -f

#
# a version is already installed.  ask user if installing a new one, upgrading,
# or just configuring the existing FW ?
#
source scripts/aliases

	set configonly=0
	if (! -f $dist[1]) then
		E ""
		E "Software distribution $dist is missing"
		E "You may only configure current installation"
		set configonly=1
	endif

rewhat2do:
	E ""
	E ""
	E "FW directory $FWDIR exists, Do you wish to :"
	E "--------------------------------------------------------"
	E "Configure (c) - Change configuration of currently installed software"
	if (! $configonly) then 
 		E "Upgrade (u)   - Install the new software, Use old configuration and log files"
		E "Install (i)   - New installation, ignore old one"
	endif 
	E "Abort (a)     - Abort installation"
	E ""
	E ""
what2do:
	if (! $configonly) then
		E -n "Enter your selection (c/u/i/a) [a]: "
	else 
		E -n "Enter your selection (c/a) [a]: "
	endif	
	get ans
	if ("X$ans" == X) goto abort
	if ("X$ans" != Xc && "X$ans" != Xu && "X$ans" != Xi && "X$ans" != Xa) goto what2do
	if ($configonly && "X$ans" != Xc && "X$ans" != Xa) goto what2do


#
# really install over the old one, overriding the configuration and log files ?
#

	if ("X$ans" == Xi) then
		E ""
		E "WARNING: Install would override current configuration and log files."
		E -n "         Do you wish to continue with it [n] ? "
		get yn
		if ("X$yn" != Xy) goto rewhat2do
	endif

#
# user changed his mind.  abort.
#

	if ("X$ans" == Xa) goto abort

	exit 0

abort:
	exit 1
