#! /bin/sh

CLIENTS="solaris aix hpux linux drsnx freebsd"	# supported clients
BINARIES="bcnu bcnud bcnumsg"		# List of binaries to retrieve
if [ -d /usr/local/bcnu ]
then
        BCNUHOME="/usr/local/bcnu"
else
	echo "Enter directory name of bcnu home:[/usr/local/bcnu] \c"
	read home
	if [ -z "$home" ]
		then
			BCNUHOME="/usr/local/bcnu"
		else
		BCNUHOME=$home
	fi
fi

cd $BCNUHOME

. $BCNUHOME/etc/bcnuenv

if [ ! -d $BCNUHOME/platform ]
	then
		mkdir $BCNUHOME/platform
fi

BCNU="$BCNUHOME/bin/bcnu -s $BCNUPORT"

for client in $CLIENTS
do

	echo "Enter host name for client type $client: \c"
	read host
	if [ -z "$host" ]
		then
			echo "Skipping $client.."
			continue
	fi
	for binary in $BINARIES
	do
		echo "Getting $binary from $host:\t\c"
		if $BCNU -a get -f /bin/$binary $host >$BCNUHOME/platform/$binary.$client
			then
				echo "OK"
		else
				echo "Failed"
				rm $BCNUHOME/platform/$binary.$client
		fi
	done
	echo "$client binaries complete"
done
