#! /bin/csh/ -f
#
# (c) Copyright 1993-1997 Check Point Software Technologies Ltd.
# All rights reserved.
#
# This is proprietary information of Check Point Software Technologies
# Ltd., which is provided for informational purposes only and for use
# solely in conjunction with the authorized use of Check Point Software
# Technologies Ltd. products.  The viewing and use of this information is
# subject, to the extent appropriate, to the terms and conditions of the
# license agreement that authorizes the use of the relevant product.

#
# install FireWall-1 Authentecation Agent (fwauthagent)
#

onintr interupt

	alias E echo
	alias get 'set \!^ = $<'
	alias exists 'test -h \!^ -f \!^ -d \!^'
	alias isdir 'test -d \!^'
	alias isfile 'test -f \!^'
	set product = fwauthagent

	E ""
	E "******** FireWall-1 Authentication Agent Installation ********"
	E ""

	if ($?FWDIR) then 
		set fwsnguidir = $FWDIR/bin
	else
		set fwsnguidir = /etc/fw/bin
	endif

	isfile ./$product
	if ($status != 0) then
		E "Installation file $product is missing. Aborintg..."
		exit 1
	endif

getdestdir:
	E -n "Please select directory to install $product [$fwsnguidir]: "
	get dir
	if ("X$dir" == X) set dir = $fwsnguidir
	set tmp = ($dir); if ($#tmp != 1) goto getdestdir
	isdir $dir; 
	E ""
	if ($status != 0) then
		E -n "Creating $dir..."
		mkdir $dir
		if ($status != 0) then
			E "Failed."
			goto getdestdir
		else
			E "Done."
		endif
	endif

okdir:
	isfile $dir/$product
	if ($status == 0) then
		E "$dir/$product exists, moving it to $dir/$product.bak.$$"
		\mv $dir/$product $dir/$product.bak.$$
	endif

	E -n "Copying fwauthagent file..."
	\cp ./$product $dir/$product
	if ($status != 0) then
		E "Failed."
		exit 1
	else
		E "Done."
	endif

	E -n "$product is now installed. Do you want to start it now (y/n) [y] ?"
	get ans
	if ("X$ans" == "Xn") goto end

	$dir/$product &

	if ($status != 0) then
		E "Failed to run $dir/$product, please run it by yourself"
	else
		E "FireWall-1 Authentecation Agent $dir/$product has been started"
	endif

end:
	E "To activate FireWall-1 Authentication Agent automatically during startup,"
	E "please add the following line to your rc files:"
	E "$dir/$product &"
	E "Thank You."

	exit 0

interupt:
	exit 1



