#!/bin/sh

##########################################################################
#   Title:
#       Optional, defaults to the name of the script sans extention
#
#   Section:
#       8
#
#   Synopsis:
#       
#   Description:
#       
#   Arguments:
#       
#   Returns:
#
#   Examples:
#
#   Files:
#
#   Environment:
#
#   See also:
#       
#   History:
#   Date        Name        Modification
#   2024-11-11  Jason Bacon Add man page template and usage
##########################################################################

usage()
{
    printf "Usage: $0\n"
    exit 1
}


##########################################################################
#   Main
##########################################################################

if [ $# != 0 ]; then
    usage
fi

case $(auto-ostype) in
FreeBSD)
    auto-enable-service -s statd rpc_statd $0
    auto-enable-service -s lockd rpc_lockd $0
    
    service lockd restart
    service statd restart
    
    if ! auto-service-enabled autofs; then
	auto-enable-service autofs $0
    else
	printf "autofs already enabled.\n"
    fi
    
    for service in automount automountd autounmountd; do
	service $service start
    done
    
    # FIXME: Add automount -u to /etc/rc.suspend
    ;;

NetBSD)
    auto-enable-service statd $0
    auto-enable-service lockd $0
    
    service lockd restart
    service statd restart
    
    if ! auto-service-enabled autofs; then
	auto-enable-service autofs $0
    else
	printf "autofs already enabled.\n"
    fi
    
    for service in automount automountd autounmountd; do
	service $service start
    done
    
    # FIXME: Add automount -u to /etc/rc.suspend
    ;;

*)
    auto-unsupported-os $0
    exit 1
    ;;

esac
