#!/bin/sh
#
# Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved
#

#
# Exit if not removing from the running system
#
[ "${PKG_INSTALL_ROOT:-/}" = "/" ] || exit 0

pkill -U svctag stosreg 2>/dev/null

# Ensure SMF services are stopped

for SVC in stosreg
do
     SERVICE="svc:/application/${SVC}:default"
     /usr/bin/svcprop -q ${SERVICE}
     if [ $? -eq 0 ]; then
        svcadm disable ${SERVICE}
        if [ $? -ne 0 ]; then
           echo "\n$0 Disabling of ${SERVICE} failed!\n" >&2
           exit 1
        fi
        svcadm refresh ${SERVICE}
     fi
done

exit 0
