#! /bin/csh -f

#
# Do we have a license ?  if not, install one
#
source scripts/aliases

	E "Installing license"
	E "------------------"

	if ("X$upgrade" == Xy) then
		E -n "Restoring licenses..."
		if ( -e $tmpdir/fw.license) then
			cp -p $tmpdir/fw.license $FWDIR/conf
			fw putlic -K >& /dev/null
			set upgradelic
		endif
	endif

	if ( -f fw.LICENSE ) then
		E ""
		E -n "Reading pre-installed license file fw.LICENSE... "
		cp fw.LICENSE $FWDIR/conf >& /dev/null
		E "done."
		goto licread
	endif

	if ( -f $FWDIR/conf/fw.LICENSE ) then
		E ""
		E -n "Reading pre-installed license file $FWDIR/conf/fw.LICENSE... "
		E "done."
		goto licread
	endif

	if (! $?upgradelic) then
		E ""
		E "No License is available."
		exit 0
	endif
		

licread:
	E ""
	E "The following evaluation License key is provided with this $product distribution"
	$FWDIR/bin/fw putlic -C -l $FWDIR/conf/fw.LICENSE
	E " "
	E -n "Do you want to use this evaluation FW-1 license (y/n) [y]? "
	get yn
	if ("X$yn" == X || "X$yn" == Xy) then
		E ""
		E "Using Evaluation License String"
		E ""
		if ($?upgradelic) then
			$FWDIR/bin/fw putlic -m $FWDIR/$module -l $FWDIR/conf/fw.LICENSE
		else
			$FWDIR/bin/fw putlic -o -m $FWDIR/$module -l $FWDIR/conf/fw.LICENSE
		endif

		E " "
	endif
	exit 0

