#!/sbin/sh
#
# Copyright 2011, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms.
#
#pragma ident	"@(#)svc-consolekit.src	1.1	06/02/06 SMI"
#
# For modifying parameters passed to dtlogin, do not edit
# this script. Instead use svccfg(1m) to modify the SMF
# repository. For example:
#
# # svccfg
# svc:> select system/consolekit
# svc:/system/consolekit> setprop consolekit/args = "--fatal-warnings"
# svc:/system/consolekit> exit

. /lib/svc/share/smf_include.sh

if smf_is_nonglobalzone; then
           /usr/sbin/svcadm disable -t svc:/system/consolekit
           echo "console-kit-daemon cannot be run in non-global zones"
           sleep 5 &
           exit $SMF_EXIT_OK
fi

case "$1" in
'start')
	FMRI=svc:/system/consolekit

	arg=`eval "echo \`svcprop -p consolekit/args $FMRI\`"`

	/usr/sbin/console-kit-daemon $arg

	rc=$?
	if [ $rc -ne 0 ]; then
		echo "$0: consolekit failed with $rc"
		exit $SMF_EXIT_ERR_FATAL 
	fi
	;;

*)
	echo "Usage: $0 { start }"
	exit $SMF_EXIT_ERR_FATAL
	;;
esac

exit $SMF_EXIT_OK
