#!/bin/sh

# PROVIDE: radiusd
# REQUIRE: NETWORKING SERVERS
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable radiusd:
#
# radiusd_enable="YES"
#

. /etc/rc.subr

name=radiusd
rcvar=`set_rcvar`
load_rc_config $name

command=/usr/local/sbin/radiusd
pidfile=/var/run/radiusd/radiusd.pid

# The radiusd_config parameter is now obsolete. Instead, derive the
# configuration directory name from radiusd_flags if possible, otherwise
# default to /usr/local/etc/raddb
required_dirs=`echo ${radiusd_flags} | sed -Ee 's:.*\-[^[:space:]d]*d[[:space:]]*([^[:space:]]+).*:\1:'`
required_dirs=${required_dirs:-"/usr/local/etc/raddb"}

required_files="${required_dirs}/radiusd.conf"

radiusd_enable=${radiusd_enable-"NO"}

run_rc_command "$1"
