#!/bin/sh
#
#ident	"@(#)preremove	1.3	04/10/28 SMI"
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
PATH="/usr/bin:/usr/sbin:${PATH}"; export PATH

SERVICE="svc:/system/device/fc-fabric:default"

#
# The following case implies that the installation was not on the root disk
#
if [ "${PKG_INSTALL_ROOT}" != "" -a "${PKG_INSTALL_ROOT}" != "/" ]; then
	#
	# Do not disable the service in this case.
	#
	exit 0
fi

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

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

#
# Check to see if the service is running and if so disable it.
#
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
