#!/bin/sh

# $FreeBSD$
#
# PROVIDE: netifyd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# netifyd_enable (bool):	Set to NO by default.
#							Set it to YES to enable netifyd.

. /etc/rc.subr

name="netifyd"
rcvar="${name}_enable"

command="/usr/local/sbin/${name}"

start_precmd="${name}_prestart"

netifyd_prestart()
{
    if [ -f /etc/version ]; then
        # pfSense detected, enable auto-detect:
        export NETIFYD_AUTODETECT="yes"
    fi
    . /usr/local/share/netifyd/functions.sh
    netifyd_opts=$(auto_detect_options)
    rc_flags="${netifyd_opts} ${rc_flags}"

    return 0
}

load_rc_config $name

: ${netifyd_enable:=no}

run_rc_command "$1"
