From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/blueness:master commit in: net-misc/tor/files/, net-misc/tor/
Date: Tue, 30 Aug 2011 11:30:53 +0000 (UTC) [thread overview]
Message-ID: <b8a558a87e3b1242cc6c7b746fcf9d2ce70a9b75.blueness@gentoo> (raw)
commit: b8a558a87e3b1242cc6c7b746fcf9d2ce70a9b75
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 30 11:30:15 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Aug 30 11:30:15 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=b8a558a8
net-misc/tor: make tor.initd-r5 checkvarrun fool proof
---
net-misc/tor/ChangeLog | 3 +++
net-misc/tor/files/tor.initd-r5 | 33 +++++++++++++++++++++++----------
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/net-misc/tor/ChangeLog b/net-misc/tor/ChangeLog
index 051ef02..31c4316 100644
--- a/net-misc/tor/ChangeLog
+++ b/net-misc/tor/ChangeLog
@@ -2,6 +2,9 @@
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/ChangeLog,v 1.269 2011/08/28 11:15:42 blueness Exp $
+ 30 Aug 2011; Anthony G. Basile <blueness@gentoo.org> files/tor.initd-r5:
+ Make tor.initd-r5 checkvarrun fool proof
+
30 Aug 2011; Anthony G. Basile <blueness@gentoo.org> files/torrc-r1,
files/torrc.sample.patch:
Remove obsolete configuration option 'Group'
diff --git a/net-misc/tor/files/tor.initd-r5 b/net-misc/tor/files/tor.initd-r5
index f55fefb..d27a411 100644
--- a/net-misc/tor/files/tor.initd-r5
+++ b/net-misc/tor/files/tor.initd-r5
@@ -3,14 +3,33 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r4,v 1.7 2011/08/23 12:26:36 blueness Exp $
-opts="${opts} checkconfig reload"
-PIDFILE=/var/run/tor/tor.pid
-CONFFILE=/etc/tor/torrc
+opts="${opts} checkconfig checkvarrun reload"
+PIDDIR="/var/run/tor"
+PIDFILE="${PIDDIR}/tor.pid"
+CONFFILE="/etc/tor/torrc"
depend() {
need net
}
+checkvarrun()
+{
+ # Check if /var/run/tor exists, create it if it doesn't
+ [ ! -d /var/run/tor ] && mkdir -p /var/run/tor
+ [ ! -d /var/run/tor ] && return 1
+
+ # The directory definitly exists now, but does it belong to tor?
+ find ${PIDDIR} -maxdepth 0 -a -user tor -a -group tor >/dev/null && chown tor:tor ${PIDDIR}
+ find ${PIDDIR} -maxdepth 0 -a -user tor -a -group tor >/dev/null && return 1
+
+ # And does it have the right perms?
+ find ${PIDDIR} -maxdepth 0 -perm 0755 >/dev/null && chmod 0755 /var/run/tor
+ find ${PIDDIR} -maxdepth 0 -perm 0755 >/dev/null && return 1
+
+ # If any of the above failed, we would not be here
+ return 0
+}
+
checkconfig() {
# first check that it exists
if [ ! -f ${CONFFILE} ] ; then
@@ -29,17 +48,11 @@ checkconfig() {
/usr/bin/tor --verify-config -f ${CONFFILE}
return 1
fi
-
- # finally check if /var/run/tor exists and belongs to tor:tor
- if [ ! -d /var/run/tor ] ; then
- mkdir -p /var/run/tor
- chown tor:tor /var/run/tor
- chmod 0755 /var/run/tor
- fi
}
start() {
checkconfig || return 1
+ checkvarrun || return 1
ebegin "Starting Tor"
HOME=/var/lib/tor
start-stop-daemon --start --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor -- -f "${CONFFILE}" --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/null 2>&1
next reply other threads:[~2011-08-30 11:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-30 11:30 Anthony G. Basile [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-11-26 15:19 [gentoo-commits] dev/blueness:master commit in: net-misc/tor/files/, net-misc/tor/ Anthony G. Basile
2011-11-25 13:01 Anthony G. Basile
2011-08-31 11:46 Anthony G. Basile
2011-08-30 13:47 Anthony G. Basile
2011-08-30 4:06 Anthony G. Basile
2011-08-30 4:01 Anthony G. Basile
2011-08-30 3:35 Anthony G. Basile
2011-07-23 11:29 Anthony G. Basile
2011-07-22 17:30 Anthony G. Basile
2011-06-07 21:16 Anthony G. Basile
2011-06-07 21:00 Anthony G. Basile
2011-06-06 17:27 Anthony G. Basile
2011-06-06 16:54 Anthony G. Basile
2011-05-30 20:49 Anthony G. Basile
2011-05-30 20:48 Anthony G. Basile
2011-05-10 11:37 Anthony G. Basile
2011-05-07 19:29 Anthony G. Basile
2011-04-11 0:48 Anthony G. Basile
2011-04-09 17:39 Anthony G. Basile
2011-04-05 11:57 Anthony G. Basile
2011-03-27 4:39 Anthony G. Basile
2011-03-27 4:01 Anthony G. Basile
2011-03-25 0:14 Anthony G. Basile
2011-02-10 0:02 Anthony G. Basile
2011-02-09 23:55 Anthony G. Basile
2011-02-09 23:29 Anthony G. Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8a558a87e3b1242cc6c7b746fcf9d2ce70a9b75.blueness@gentoo \
--to=blueness@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox