#! /usr/bin/sh
#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"@(#)preremove	1.3	05/01/07 SMI"
#

PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

SERVICE="svc:/network/iscsi_initiator:default"

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

#
# Confirm service is installed, otherwise exit.
#
/usr/bin/svcprop -q ${SERVICE} || exit 0

#
# Check to see if the service is enabled and if so disable it.
#

SVCPROP=`svcprop -p general/enabled ${SERVICE}`

if [ "${SVCPROP}" = "true" ]; then
        svcadm disable ${SERVICE}
        if [ $? -ne 0 ]; then
                echo "\n$0 Disabling of ${SERVICE} failed!\n" >&2
                exit 1
        fi
fi

exit 0
