Allow clients to use relays as bridges
[tor/rransom.git] / contrib / rc.subr
blobd757e89528fdfb0dd5d7109c53e483ddc5b20d6e
1 #!/bin/sh
2 # $FreeBSD: ports/security/tor-devel/files/tor.in,v 1.1 2006/02/17 22:21:25 mnag Exp $
4 # (rc.subr written by Peter Thoenen for Net/FreeBSD)
6 # REQUIRE: NETWORKING SERVERS USR
7 # BEFORE: LOGIN
9 # Add the following lines to /etc/rc.conf to enable tor
11 # tor_enable (bool): Set to "NO" by default
12 # Set it to "YES" to enable tor
13 # tor_conf (str): Points to your tor conf file
14 # Default: /usr/local/etc/tor/torrc
15 # tor_user (str): Tor Daemon user. Default _tor
18 . /etc/rc.subr
20 name="tor"
21 rcvar=${name}_enable
23 load_rc_config ${name}
25 : ${tor_enable="NO"}
26 : ${tor_conf="/usr/local/etc/tor/torrc"}
27 : ${tor_user="_tor"}
28 : ${tor_pidfile="/var/run/tor/tor.pid"}
29 : ${tor_logfile="/var/log/tor"}
30 : ${tor_datadir="/var/run/tor"}
32 required_files=${tor_conf}
33 required_dirs=${tor_datadir}
34 command="/usr/local/bin/${name}"
35 command_args="-f ${tor_conf} --pidfile ${tor_pidfile} --runasdaemon 1 --datadirectory ${tor_datadir} --user ${tor_user}"
36 extra_commands="log"
37 log_cmd="${name}_log"
39 tor_log() {
40 cat ${tor_logfile}
43 run_rc_command "$1"