#!/bin/sh

### BEGIN INIT INFO
# Provides:          unfs3
# Required-Start:    $network
# Required-Stop:     $network
# Should-Start:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts user-space NFSv3 server
# Description:       UNFS3 is a user-space implementation of the NFSv3 server
#                    specification.
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/unfsd
NAME=unfs3
DESC=unfs3

test -x $DAEMON -a -f /etc/exports || exit 0

# Include #PACKAGE# defaults if available
if [ -f /etc/default/unfs3 ]
then
	. /etc/default/unfs3
fi

set -e

case "$1" in
	start)
		echo -n "Starting $DESC: "
		start-stop-daemon --start --quiet --oknodo --exec $DAEMON \
			-- $DAEMON_OPTS
		echo "$NAME."
		;;

	stop)
		echo -n "Stopping $DESC: "
		start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
		echo "$NAME."
		;;

	restart|force-reload)
		echo -n "Restarting $DESC: "
		start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
		sleep 1
		start-stop-daemon --start --quiet --oknodo --exec $DAEMON \
			-- $DAEMON_OPTS
		echo "$NAME."
		;;

	*)
		N=/etc/init.d/$NAME
		echo "Usage: $N {start|stop|restart|force-reload}" >&2
		exit 1
		;;
esac

exit 0
