1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00
freebsd-ports/dns/radns/files/radns.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

71 lines
1.4 KiB
Bash

#! /bin/sh
#
# PROVIDE: radns
# REQUIRE: DAEMON LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable radns:
#
# radns_enable (bool): Set it to "YES" to enable radns
# Default is "NO".
# radns_resolv (path): Full path to radns' own resolv.conf
# radns_pidfile (path): Full path to pid file.
# radns_script (path): Full path to script file or empty string if no script.
# radns_username (user): Username the daemon will run as.
#
. /etc/rc.subr
name=radns
rcvar=radns_enable
radns_dir="%%PREFIX%%/etc/radns"
load_rc_config $name
# Default values
: ${radns_enable="NO"}
: ${radns_pidfile="/var/run/${name}.pid"}
: ${radns_resolv="${radns_dir}/radns-resolv.conf"}
: ${radns_script=""}
: ${radns_username="radns"}
command="%%PREFIX%%/bin/${name}"
start_precmd=start_precmd
stop_postcmd=stop_postcmd
start_precmd()
{
[ -d ${radns_dir} ] || mkdir ${radns_dir}
chown ${radns_username} ${radns_dir}
}
stop_postcmd()
{
rm -f ${radns_resolv}
rm -f ${radns_pidfile}
}
# if script:
if [ x${radns_script} != "x" ]
then
command_args="-f ${radns_resolv} -s ${radns_script} -u ${radns_username} \
-p ${radns_pidfile}"
else
command_args="-f ${radns_resolv} -u ${radns_username} -p ${radns_pidfile}"
fi
reload_precmd()
{
echo "Stopping ${name} and start gracefully."
}
reload_postcmd()
{
rm -f ${radns_pidfile}
run_rc_command start
}
# actually execute the program
run_rc_command "$1"