#!/usr/bin/ksh
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

MYNAME=`basename ${0}`
MYDIR=`dirname ${0}`

. ${MYDIR}/../etc/config
. ${MYDIR}/../../lib/functions_static
. ${MYDIR}/functions

USE_INTERNAL_DEP=TRUE

typeset opt

while getopts 'R:G:P:Z' opt
do
        case "$opt" in
                R)      RESOURCE=$OPTARG;;
                G)      RESOURCEGROUP=$OPTARG;;
		P)	PARFILE=$OPTARG;;
                Z)      USE_INTERNAL_DEP=FALSE;;
                *)      exit 1;;
        esac
done

debug_message "Method: `basename $0` - Begin"
$SET_DEBUG

# exit from start, if the options are wrong

validate_options
rc_val=${?}
if [ ${rc_val} -ne 0 ]
then
        debug_message "Method: `basename $0` - End (Exit 1)"
	exit 1
fi

rm $LOGFILE 2>/dev/null

if ! validate
then
        debug_message "Method: `basename $0` - End (Exit 1)"
        exit 1
fi

# Source the Sun One Provisioning Server specific parameter file
. ${PARFILE}


if start_spsma
then
        log_message notice "start_command rc<$rc_start_command>"
        debug_message "Method: `basename $0` - End (Exit 0)"
        exit 0
else
        log_message err "start_command rc<$rc_start_command>"
fi

debug_message "Method: `basename $0` - End (Exit 0)"

exit 0
