#!/bin/sh
#
# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)preremove.tmpl	1.2	03/12/11 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() {

	if [ ! "${PKG_INSTALL_ROOT:-/}" = "/" ]; then
		return 0
	fi

	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
}

