#!/bin/sh
#
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2004 VERITAS Software Corporation, All Rights Reserved $
#***************************************************************************
#
# fimselector
#
# fimselector <master_server> 
# - find the available frozen image methods for each policy on the master server.
#
# fimselector <master_server> <client> <policy> <filelist type: fs or raw> 
# - find the available frozen image methods for the client of the policy 
#   on the master server.
#

BPCLIENT=/usr/openv/netbackup/bin/admincmd/bpclient 

master_server="${1}"
client="${2}"
policy="${3}"
fltype="${4}"

/usr/openv/netbackup/bin/admincmd/bpauthorize -test_admin >/dev/null
status=$?
if [ ${status} -ne 0 ] ; then
	echo ""
	echo "You do not have the proper authorization to perform"
	echo "this task.  Please resolve and try again."
	exit ${status}
fi

if [ -z "${master_server}" ]; then
	echo "master server name needs to be specified"
	exit 1
fi
if [ -z "${client}" ] && [ -z "${policy}" ]; then
	echo "find the available snapshot method for all policies on master: $master_server"
	${BPCLIENT} -M $master_server -auto_select -all
	exit $? 
fi
if [ -z "${policy}" ]; then
	echo "master: $master_server client: $client"
	echo "policy name needs to be specified"
	exit 1
fi
if [ -z "${fltype}" ]; then
	echo "master: master_server client: $client policy: $policy"
	echo "filelist type needs to be specified"
	exit 1
fi
echo "find the available snapshot method for policy: $policy on client: $client"
${BPCLIENT} -M $master_server -client $client -policy $policy -auto_select -$fltype 

exit $? 

