#!/bin/sh
# $FreeBSD: ports/www/www6to4/files/www6to4.in,v 1.4 2012/11/17 06:03:11 svnexp Exp $
#
# PROVIDE: www6to4
# REQUIRE: DAEMON
#
# Add the following to /etc/rc.conf[.local] to enable this service
#
# www6to4_enable="YES"
#

. /etc/rc.subr

name=www6to4
rcvar=www6to4_enable

command=/usr/local/sbin/www6to4
WWW6TO4DIR=/usr/local/etc/www6to4

www6to4_enable=${www6to4_enable:-"NO"}
www6to4_config=${www6to4_config:-"${WWW6TO4DIR}/www6to4.conf"}
www6to4_flags=${www6to4_flags:-"-c ${www6to4_config}"}
www6to4_user=${www6to4_user:-"nobody"}
www6to4_chdir=${WWW6TO4DIR}

required_files=${www6to4_config}
required_dirs=${WWW6TO4DIR}

start_cmd=www6to4_start

www6to4_start() {
    checkyesno www6to4_enable && echo "Starting ${name}." && \
    chdir ${www6to4_chdir} && su -m ${www6to4_user} -c "$command ${www6to4_flags} &"
}

load_rc_config ${name}
run_rc_command "$1"
