#!/bin/sh

# PROVIDE: opendnssec
# REQUIRE: LOGIN DAEMON
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable opendnssec:
#
# opendnssec_enable="YES"

ODS_CONTROL=%%PREFIX%%/sbin/ods-control

. /etc/rc.subr

name=opendnssec
rcvar=opendnssec_enable

load_rc_config $name

opendnssec_enable=${opendnssec_enable:-"NO"}
: ${opendnssec_svcj_options:="net_basic"}

start_cmd="${name}_run start"
stop_cmd="${name}_run stop"
restart_cmd="${name}_restart"
status_cmd="${name}_status"
reload_cmd="${name}_reload"
extra_commands="reload status"

opendnssec_run()
{
    $ODS_CONTROL $1
}

opendnssec_restart()
{
    $ODS_CONTROL stop
    $ODS_CONTROL start
}

opendnssec_reload()
{
    echo "OpenDNSSEC reloading:"
    echo -n "  Signer  : "; $ODS_CONTROL signer reload
    echo -n "  Enforcer: "; $ODS_CONTROL enforcer reload
}

opendnssec_status()
{
    echo "OpenDNSSEC status:"
    echo -n "  Signer  : "; $ODS_CONTROL signer running
    echo -n "  Enforcer: "; $ODS_CONTROL enforcer running
}

run_rc_command "$1"
