#!/bin/sh
#PKG nfs-utils
#INIT 70
. /etc/rc.conf

case $1 in
autostop) ;;
autostart)
	test x"${rpcbind:-NO}" = x"NO" && exit 0
	test x"${nfs_client:-NO}" = x"NO" && exit 0
	exec sh $0 start
	;;
start)
	mkdir -p /var/lib/nfs/rpc_pipefs
	mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
	/usr/sbin/idmapd
	/usr/sbin/gssd
	;;
stop)
	kill $(pgrep -f /usr/sbin/idmapd)
	kill $(pgrep -f /usr/sbin/gssd)
	umount /var/lib/nfs/rpc_pipefs
	;;
restart)
	sh $0 stop
	sh $0 start
	;;
*)
	echo "Usage: $0 {start | stop | restart}"
	exit 1
	;;
esac
exit $?
