#! /bin/sh
#
# inet          Start TCP/IP networking services. This script
#               sets the hostname, creates the routes and
#               starts the Internet Network Daemon & RPC portmapper.
#
# Author:       Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#               Modified for RHS Linux by Damien Neil
#

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
	exit 0
fi

[ -f /usr/sbin/inetd ] || exit 0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting INET services: "
	daemon inetd

	echo
	touch /var/lock/subsys/inet
	;;
  stop)
	echo -n "Unmounting NFS filesystems: "
	cat /etc/mtab | while read dev mpoint type foo; do
		if [ "$type" = "nfs" ]; then
			echo -n "$mpoint "
			umount $mpoint
		fi
	done
	echo

	echo -n "Stopping INET services: "
	killproc inetd

	echo
	rm -f /var/lock/subsys/inet
	;;
  *)
	echo "Usage: inet {start|stop}"
	exit 1
esac

exit 0
