pkgsrc/net/tor/files/tor.in
wiz 060c1011f1 Fix two problems when building on NetBSD-6.x.
Mention upstream bug reports filed for them.

Addresses PR 50521 by Uwe Toenjes.

While here, add reload command to rc.d script and bump PKGREVISION.
2015-12-11 12:13:00 +00:00

46 lines
824 B
Text

#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: tor.in,v 1.5 2015/12/11 12:13:00 wiz Exp $
#
# PROVIDE: tor
# REQUIRE: DAEMON NETWORKING
# KEYWORD: shutdown
#
# You will need to set some variables in /etc/rc.conf to start tor:
#
# tor=YES
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="tor"
rcvar=$name
command="@PREFIX@/bin/tor"
required_files="@PKG_SYSCONFDIR@/torrc"
start_cmd="tor_start"
stop_cmd="tor_stop"
pidfile="@PKG_HOME@/${name}.pid"
restart_cmd="tor_stop ; tor_start"
extra_commands="reload"
tor_start ()
{
${command} --User @TOR_USER@ --RunAsDaemon 1 \
--DataDirectory @PKG_HOME@ --PIDFile ${pidfile}
}
tor_stop()
{
kill `cat ${pidfile}` 2>/dev/null
}
if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
then
load_rc_config $name
run_rc_command "$1"
else
eval ${start_cmd}
fi