#!/bin/sh
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)preremove.tmpl	1.2	04/03/12 SMI"
#

#
# Copyright (c) 2000 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident	"@(#)proc.inetd_usrprerem	1.1	00/12/08 SMI"
#

# proc.inetd_usrprerem -- common code for inetd.conf entry removal
#
# inetd_check	: call in preremove to make sure service isn't running

inetd_check() {

	for i in "$@"; do
		/usr/bin/pgrep -x -u 0 "$i"
		if [ $? -eq 0 ]; then
			echo "\"$i\" running; unable to remove package"
			return 1
		fi
	done

	return 0
}

# check if any of SLVM daemons are still running

inetd_check rpc.metad rpc.metamhd rpc.metamedd rpc.mdcommd
if [ $? -ne 0 ]; then
	exit 1
fi
