#!/bin/bash

# sourcing our current rc.conf requires this to be a bash script
. /usr/lib/rc/functions

case "$1" in
    start)
        stat_busy "Mounting network filesystems"
        mount -a -t "$NETFS"
        rc=$?
        mount -a -O _netdev
        (( rc || $? )) && stat_die
        add_daemon netfs
        stat_done
        ;;
    stop)
        stat_busy "Unmounting network filesystems"
        umount -a -f -O _netdev
        rc=$?
        umount -a -f -t "$NETFS"
        (( rc || $? )) && stat_die
        rm_daemon netfs
        stat_done
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
