summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Faulhammer <fauli@gentoo.org>2009-06-03 13:02:24 +0000
committerChristian Faulhammer <fauli@gentoo.org>2009-06-03 13:02:24 +0000
commit03b9c875af144d6fc92f2c5fd8515413219f8515 (patch)
tree39c92f2c503713f522d812230dfaad3ffab811d2 /net-misc/tor/files/tor.initd-r6
parentclean up (diff)
downloadgentoo-2-03b9c875af144d6fc92f2c5fd8515413219f8515.tar.gz
gentoo-2-03b9c875af144d6fc92f2c5fd8515413219f8515.tar.bz2
gentoo-2-03b9c875af144d6fc92f2c5fd8515413219f8515.zip
revision bump to make it compatible with Baselayout 1, as reported by Stanislav Cymbalov <DummyUnit AT gmail.com> in bug 272404
(Portage version: 2.1.6.11/cvs/Linux i686, RepoMan options: --force)
Diffstat (limited to 'net-misc/tor/files/tor.initd-r6')
-rw-r--r--net-misc/tor/files/tor.initd-r657
1 files changed, 57 insertions, 0 deletions
diff --git a/net-misc/tor/files/tor.initd-r6 b/net-misc/tor/files/tor.initd-r6
new file mode 100644
index 000000000000..42557392fb04
--- /dev/null
+++ b/net-misc/tor/files/tor.initd-r6
@@ -0,0 +1,57 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r6,v 1.1 2009/06/03 13:02:24 fauli Exp $
+
+opts="${opts} checkconfig reload"
+PIDFILE=/var/run/tor/tor.pid
+CONFFILE=/etc/tor/torrc
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ # first check that it exists
+ if [ ! -f ${CONFFILE} ] ; then
+ eerror "You need to setup ${CONFFILE} first"
+ eerror "Example is in ${CONFFILE}.sample"
+ return 1
+ fi
+
+ # now verify whether the configuration is valid
+ /usr/bin/tor --verify-config --User tor -f ${CONFFILE} > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ einfo "Tor configuration (${CONFFILE}) is valid."
+ return 0
+ else
+ eerror "Tor configuration (${CONFFILE}) not valid."
+ /usr/bin/tor --verify-config --User tor -f ${CONFFILE}
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting Tor"
+ HOME=/var/lib/tor
+ start-stop-daemon --start --user tor --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor -- --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/null 2>&1
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Tor"
+ start-stop-daemon --stop --user tor --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
+ eend $?
+}
+
+reload() {
+ if [ ! -f ${PIDFILE} ]; then
+ eerror "${SVCNAME} isn't running"
+ return 1
+ fi
+ checkconfig || return 1
+ ebegin "Reloading Tor configuration"
+ start-stop-daemon --stop --oknodo --signal HUP --pidfile ${PIDFILE}
+ eend $?
+}