#!/bin/ksh -p
#
# ident "@(#)utshutdown-srss.ksh	1.5	11/03/10 Oracle"
#
# Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
#
#
# utshutdown-srss
#
# Description:
#   Stop Sunray daemon before installation/removal procedure
#
# Parameters:
#   (none)
#
PATH=/usr/bin:/bin:/usr/sbin:/sbin
export PATH

typeset utprodinfo=/opt/SUNWut/lib/utprodinfo
typeset initd="/etc/init.d"
typeset -r xmgr=/etc/opt/SUNWut/xmgr
typeset OS=`uname -s`

if [ -x $utprodinfo ] && $utprodinfo -t installed SUNWuto; then

    print "\nStopping Sun Ray services, please wait ..."
    [[ -x "${initd}/utsvc" ]] && ${initd}/utsvc stop 
    [[ -x "${initd}/utwadmin" ]] && ${initd}/utwadmin stop 
    [[ -x "${initd}/utstorage" ]] && ${initd}/utstorage stop
    [[ -x "${initd}/utds" ]] && ${initd}/utds stop 
    [[ -x "${initd}/utacleanup" ]] && ${initd}/utacleanup stop
    [[ -x "${xmgr}/reset-dpy" ]] && ${xmgr}/reset-dpy
    [[ -x "${xmgr}/notify" ]] && ${xmgr}/notify

    if [ $OS = "SunOS" ]; then
	PCSC_FMRI=svc:/application/security/pcscd:default
	svcs $PCSC_FMRI >/dev/null 2>&1 && svcadm disable $PCSC_FMRI
    fi

fi

exit 0
