#!/sbin/sh
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)svc-dcs	1.2	06/06/08 SMI"
#
# Start script for dcs
#
# For modifying parameters passed to dcs, do not edit
# this script. Instead use svccfg(1m) to modify the SMF
# repository. For example:
#
# svccfg
# svc:> select platform/sun4u/dcs
# svc:/platform/sun4u/dcs> setprop dcs/ah_auth = "md5"
# svc:/platform/sun4u/dcs> exit


. /lib/svc/share/smf_include.sh

FMRI=svc:/platform/sun4u/dcs

getproparg() {
	val=`svcprop -p $2 $FMRI`
	[ -n "$val" ] && [ "$val" != 'none' ] &&  echo $1 $val
}

DCS=/usr/lib/dcs
platform=`/sbin/uname -i`
e10k="SUNW,Ultra-Enterprise-10000"
sf15k="SUNW,Sun-Fire-15000"
opl="SUNW,SPARC-Enterprise"

args=""
if [ $platform = "$sf15k" ]; then
	args="$args `getproparg -a dcs/ah_auth`"
	args="$args `getproparg -e dcs/esp_encr`"
	args="$args `getproparg -u dcs/esp_auth`"
elif [ $platform = "$opl" ]; then
	args="-l"
fi

if [ $platform = "$e10k" -o $platform = "$sf15k" -o \
     $platform = "$opl" ]; then
	$DCS $args			# Fail if can't execute
	exit				# Use dcs's exit status
else
	echo "$SMF_FMRI is not supported on this platform."
	exit $SMF_EXIT_ERR_CONFIG
fi

exit 0
