#! /bin/sh
#
# inet		Start TCP/IP networking services. This script
#		sets the hostname, creates the routes and
#		starts the Internet Network Daemon & RPC portmapper.
#
# Version:	@(#) /etc/init.d/inet 1.01 26-Oct-1993
#
# Author:	Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

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

  # See how we were called.
  case "$1" in
    start)
	echo -n "Initializing INET services "
	hostname=`/bin/hostname`

	if [ "`cat /etc/NETWORKING 2>/dev/null`" = YES ]
	then
		# First, set up the ethernet card.
		ifconfig eth0 $hostname

		# Now add any needed routes.
		echo -n "routing "
		route add $hostname

		# And set up the loopback device.
		ifconfig lo localhost
		route add localhost
	else
		# Fake a primary interface.
		ifconfig lo localhost
		route add localhost
		ifconfig lo $hostname
		route add $hostname
	fi

	# Start the INET and RPC services.
	daemon /usr/sbin/inetd
	daemon /usr/sbin/portmap
	echo

	# Mount any NFS file systems.
	mount -a -tnfs
	;;
    stop)
	# Stop INET services.
	echo -n "Shutting down INET services "
	killproc inetd
	killproc portmap
	echo
	umount -a -tnfs
	;;
    *)
	# Oops someone made a typo.
	echo "Usage: /etc/init.d/inet {start|stop}"
	exit 1
  esac

  exit 0
