From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QyMX0-0003Uq-3O for garchives@archives.gentoo.org; Tue, 30 Aug 2011 11:31:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3DF1D21C259; Tue, 30 Aug 2011 11:30:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id ECDB821C259 for ; Tue, 30 Aug 2011 11:30:54 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6308E1B41A6 for ; Tue, 30 Aug 2011 11:30:54 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id BAA3180040 for ; Tue, 30 Aug 2011 11:30:53 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: Subject: [gentoo-commits] dev/blueness:master commit in: net-misc/tor/files/, net-misc/tor/ X-VCS-Repository: dev/blueness X-VCS-Files: net-misc/tor/ChangeLog net-misc/tor/files/tor.initd-r5 X-VCS-Directories: net-misc/tor/files/ net-misc/tor/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: b8a558a87e3b1242cc6c7b746fcf9d2ce70a9b75 Date: Tue, 30 Aug 2011 11:30:53 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 6e3b458cd387d694a355c1c9dfb0d88b commit: b8a558a87e3b1242cc6c7b746fcf9d2ce70a9b75 Author: Anthony G. Basile gentoo org> AuthorDate: Tue Aug 30 11:30:15 2011 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Tue Aug 30 11:30:15 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Ddev/blueness.git;a= =3Dcommit;h=3Db8a558a8 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/0= 8/28 11:15:42 blueness Exp $ =20 + 30 Aug 2011; Anthony G. Basile files/tor.initd-r= 5: + Make tor.initd-r5 checkvarrun fool proof + 30 Aug 2011; Anthony G. Basile 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.ini= td-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 $ =20 -opts=3D"${opts} checkconfig reload" -PIDFILE=3D/var/run/tor/tor.pid -CONFFILE=3D/etc/tor/torrc +opts=3D"${opts} checkconfig checkvarrun reload" +PIDDIR=3D"/var/run/tor" +PIDFILE=3D"${PIDDIR}/tor.pid" +CONFFILE=3D"/etc/tor/torrc" =20 depend() { need net } =20 +checkvarrun() +{ + # Check if /var/run/tor exists, create it if it doesn't=20 + [ ! -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 && cho= wn tor:tor ${PIDDIR} + find ${PIDDIR} -maxdepth 0 -a -user tor -a -group tor >/dev/null && ret= urn 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 } =20 start() { checkconfig || return 1 + checkvarrun || return 1 ebegin "Starting Tor" HOME=3D/var/lib/tor start-stop-daemon --start --pidfile "${PIDFILE}" --quiet --exec /usr/bi= n/tor -- -f "${CONFFILE}" --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/= null 2>&1