#!/bin/sh
#
# $NetBSD: dccd.sh,v 1.2 2015/06/05 13:43:20 gdt Exp $
#
#
# PROVIDE: dccd
# REQUIRE: DAEMON
# BEFORE:  mail spamd dccifd
# KEYWORD: shutdown

$_rc_subr_loaded . /etc/rc.subr

name=dccd
rcvar=$name
start_precmd=dcc_precmd
start_cmd="/usr/pkg/libexec/rcDCC \${rc_flags:+-x} -m $name start"
stop_cmd="/usr/pkg/libexec/rcDCC \${rc_flags:+-x} -m $name stop"

dcc_precmd ()
{
	if [ ! -s /var/dcc/ids ]; then
		/usr/pkg/libexec/fix-map \
			-i /var/dcc/ids \
			-I /usr/pkg/share/examples/dcc/ids \
			-m /var/dcc/map \
			-t /var/dcc/map.txt \
			-T /usr/pkg/share/examples/dcc/map.txt
	fi
}

load_rc_config $name
run_rc_command "${1}"
