Lines 11-19
Link Here
|
11 |
# they are command line options. |
11 |
# they are command line options. |
12 |
# |
12 |
# |
13 |
# tor_enable (bool): Set it to "YES" to enable tor. Default: NO |
13 |
# tor_enable (bool): Set it to "YES" to enable tor. Default: NO |
|
|
14 |
# tor_instances (str): Set it to "YES" to enable tor. Default: "" |
14 |
# tor_conf (str): Points to your torrc file. |
15 |
# tor_conf (str): Points to your torrc file. |
15 |
# Default: %%PREFIX%%/etc/tor/torrc |
16 |
# Default: %%PREFIX%%/etc/tor/torrc |
16 |
# tor_user (str): Tor daemon user. Default: _tor |
17 |
# tor_user (str): Tor daemon user. Default: %%USER%% |
|
|
18 |
# tor_group (str): Tor daemon user. Default: %%GROUP%% |
19 |
# tor_pidfile (str): Tor pid file. Default: /var/run/tor/tor.pid |
17 |
# tor_datadir (str): Tor datadir. Default: /var/db/tor |
20 |
# tor_datadir (str): Tor datadir. Default: /var/db/tor |
18 |
# |
21 |
# |
19 |
|
22 |
|
Lines 25-35
Link Here
|
25 |
load_rc_config ${name} |
28 |
load_rc_config ${name} |
26 |
|
29 |
|
27 |
: ${tor_enable="NO"} |
30 |
: ${tor_enable="NO"} |
|
|
31 |
: ${tor_instances=""} |
28 |
: ${tor_conf="%%PREFIX%%/etc/tor/torrc"} |
32 |
: ${tor_conf="%%PREFIX%%/etc/tor/torrc"} |
29 |
: ${tor_user="%%USER%%"} |
33 |
: ${tor_user="%%USER%%"} |
|
|
34 |
: ${tor_group="%%GROUP%%"} |
30 |
: ${tor_pidfile="/var/run/tor/tor.pid"} |
35 |
: ${tor_pidfile="/var/run/tor/tor.pid"} |
31 |
: ${tor_datadir="/var/db/tor"} |
36 |
: ${tor_datadir="/var/db/tor"} |
32 |
|
37 |
|
|
|
38 |
instance=${2} |
39 |
if [ -n "${instance}" ]; then |
40 |
tor_conf=${tor_conf}@${instance} |
41 |
tor_pidfile=${tor_pidfile}@${instance} |
42 |
tor_datadir=${tor_datadir}/instance@${instance} |
43 |
if ! [ -r ${tor_conf} ]; then |
44 |
warn "instance config file ${tor_conf} doesn't exist or isn't readable" |
45 |
warn "you can copy the sample config %%PREFIX%%/etc/tor/torrc.sample and modify it" |
46 |
exit 1 |
47 |
fi |
48 |
if ! [ -d ${tor_datadir} ]; then |
49 |
mkdir ${tor_datadir} && \ |
50 |
chown ${tor_user}:${tor_group} ${tor_datadir} && \ |
51 |
chmod 0700 ${tor_datadir} && \ |
52 |
echo "${name}: created the instance data directory ${tor_datadir}" |
53 |
fi |
54 |
fi |
55 |
|
56 |
if [ -z "${instance}" -a -n "${tor_instances}" ]; then |
57 |
for i in ${tor_instances}; do |
58 |
%%PREFIX%%/etc/rc.d/tor $1 ${i} || warn "$1 failed for the tor instance $i" |
59 |
done |
60 |
fi |
61 |
|
33 |
required_files=${tor_conf} |
62 |
required_files=${tor_conf} |
34 |
required_dirs=${tor_datadir} |
63 |
required_dirs=${tor_datadir} |
35 |
pidfile=${tor_pidfile} |
64 |
pidfile=${tor_pidfile} |