#!/bin/sh
# this file taken from netbase pkg and modified for working with xinetd
# simply cheks for /etc/init.d/xinetd - if finds it - exits with '0'
if [ -x /etc/init.d/xinetd ] ; then
   exit 0
fi
# that was the hack, from here starts the normal netbases init script
# Start networking daemons.

test -f /usr/sbin/rpc.portmap || exit 0

case "$1" in
  start)
	echo -n "Starting base networking daemons: "
	echo -n "rpc.portmap " ; start-stop-daemon --start --quiet --exec /usr/sbin/rpc.portmap
	echo -n "inetd" ; start-stop-daemon --start --quiet --exec /usr/sbin/inetd
	echo
	;;
  stop)
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid --exec /usr/sbin/inetd
	start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/rpc.portmap
	killall -9 slattach 2>/dev/null || exit 0
	;;
  reload)
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid --signal 1 --exec /usr/sbin/inetd
	;;
  *)
	echo "Usage: /etc/init.d/netbase {start|stop}"
	exit 1
	;;
esac

exit 0
