e6dae67453
PR: ports/99970 Submitted by: Peter Thoenen <peter.thoenen@yahoo.com> (maintainer)
51 lines
1.3 KiB
Bash
51 lines
1.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: tor
|
|
# REQUIRE: NETWORKING SERVERS USR
|
|
# BEFORE: LOGIN
|
|
#
|
|
# Add the following lines to /etc/rc.conf to enable tor.
|
|
# All these options will overide any settings in your local torrc as
|
|
# they are command line options.
|
|
#
|
|
# tor_enable (bool): Set to "NO" by default
|
|
# Set it to "YES" to enable tor
|
|
# tor_conf (str): Points to your tor conf file
|
|
# Default: %%PREFIX%%/etc/tor/torrc
|
|
# tor_user (str): Tor Daemon user. Default _tor
|
|
# tor_group (str): Tor Daemon group. Default _tor
|
|
# tor_datadir (str): Tor DataDir. Defaults /var/db/tor
|
|
# tor_logfile (str): Tor Log File. Defaults /var/log/tor
|
|
#
|
|
|
|
. %%RC_SUBR%%
|
|
|
|
name="tor"
|
|
rcvar=${name}_enable
|
|
|
|
load_rc_config ${name}
|
|
|
|
: ${tor_enable="NO"}
|
|
: ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
|
|
: ${tor_user="_tor"}
|
|
: ${tor_group="_tor"}
|
|
: ${tor_pidfile="/var/run/tor/tor.pid"}
|
|
: ${tor_logfile="/var/log/tor"}
|
|
: ${tor_datadir="/var/db/tor"}
|
|
|
|
required_files=${tor_conf}
|
|
required_dirs=${tor_datadir}
|
|
pidfile=${tor_pidfile}
|
|
command="%%PREFIX%%/bin/${name}"
|
|
command_args="-f ${tor_conf} --pidfile ${tor_pidfile} --runasdaemon 1 --datadirectory ${tor_datadir} --user ${tor_user} --group ${tor_group} --log \"notice file ${tor_logfile}\""
|
|
extra_commands="log"
|
|
log_cmd="${name}_log"
|
|
|
|
tor_log() {
|
|
cat ${tor_logfile}
|
|
}
|
|
|
|
run_rc_command "$1"
|
|
|