Gentoo Archives: gentoo-commits

From: "Christian Faulhammer (opfer)" <opfer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/tor/files: tor.initd-r4
Date: Wed, 03 Sep 2008 06:57:17
Message-Id: E1KamIk-0007aD-FC@stork.gentoo.org
1 opfer 08/09/03 06:57:14
2
3 Added: tor.initd-r4
4 Log:
5 update init script to prevent runtime failures as reported in bug 235208
6 (Portage version: 2.1.4.4)
7
8 Revision Changes Path
9 1.1 net-misc/tor/files/tor.initd-r4
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/tor/files/tor.initd-r4?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/tor/files/tor.initd-r4?rev=1.1&content-type=text/plain
13
14 Index: tor.initd-r4
15 ===================================================================
16 #!/sbin/runscript
17 # Copyright 1999-2005 Gentoo Foundation
18 # Distributed under the terms of the GNU General Public License v2
19 # $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r4,v 1.1 2008/09/03 06:57:13 opfer Exp $
20
21 opts="${opts} checkconfig reload"
22 PIDFILE=/var/run/tor/tor.pid
23 CONFFILE=/etc/tor/torrc
24
25 depend() {
26 need net
27 }
28
29 checkconfig() {
30 # first check that it exists
31 if [ ! -f ${CONFFILE} ] ; then
32 eerror "You need to setup ${CONFFILE} first"
33 eerror "Example is in ${CONFFILE}.sample"
34 return 1
35 fi
36
37 # now verify whether the configuration is valid
38 /usr/bin/tor --verify-config -f ${CONFFILE} &> /dev/null
39 if [ $? -eq 0 ] ; then
40 einfo "Tor configuration (${CONFFILE}) is valid."
41 return 0
42 else
43 eerror "Tor configuration (${CONFFILE}) not valid."
44 /usr/bin/tor --verify-config -f ${CONFFILE}
45 return 1
46 fi
47 }
48
49 start() {
50 checkconfig || return 1
51 ebegin "Starting Tor"
52 HOME=/var/lib/tor
53 start-stop-daemon --start --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor -- --runasdaemon 1 --PidFile "${PIDFILE}" &> /dev/null
54 eend $?
55 }
56
57 stop() {
58 ebegin "Stopping Tor"
59 start-stop-daemon --stop --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
60 eend $?
61 }
62
63 reload() {
64 if [ ! -f ${PIDFILE} ]; then
65 eerror "${SVCNAME} isn't running"
66 return 1
67 fi
68 checkconfig || return 1
69 ebegin "Reloading Tor configuration"
70 start-stop-daemon --stop --oknodo --signal HUP --pidfile ${PIDFILE}
71 eend $?
72 }