#!/bin/sh -e

##########################################################################
#   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-fusefs-install
    pkg remove -y automount || true    # Duplicates devd-mount actions
    pkg install -y devd-mount npmount qmediamanager
    cat << EOM > /usr/local/etc/automount.conf
FM=/usr/local/bin/qmediamanager
MNT_GROUP=operator
MNT_MODE=775
EOM
    service devd restart
    ;;

NetBSD)
    auto-fusefs-install
    # These may not be available in binary packages yet
    # Install from wip if necessary
    pkgin -y install devpub-mount npmount qmediamanager || true
    cp -f $(auto-pkgsrc-prefix)/share/devpub-mount/03-devpub-mount /libexec/devpubd-hooks/
    chmod 555 /libexec/devpubd-hooks/03-devpub-mount
    auto-enable-service devpubd $0
    ;;

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

esac
