net-vpn/tor: user /run instead of /var/run, bug #685296
authorAnthony G. Basile <blueness@gentoo.org>
Sun, 8 Dec 2019 17:03:52 +0000 (12:03 -0500)
committerAnthony G. Basile <blueness@gentoo.org>
Sun, 8 Dec 2019 17:03:52 +0000 (12:03 -0500)
Closes: https://bugs.gentoo.org/685296
Package-Manager: Portage-2.3.79, Repoman-2.3.16
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
net-vpn/tor/files/tor-0.2.7.4-torrc.sample.patch
net-vpn/tor/files/tor.initd-r9 [new file with mode: 0644]
net-vpn/tor/files/torrc-r2 [new file with mode: 0644]
net-vpn/tor/tor-0.4.1.6-r1.ebuild
net-vpn/tor/tor-0.4.2.4_rc-r1.ebuild

index 92eb03bb18ea27a18ed41c7d3d6aab66edfb05b9..5f9e258de0318e78d56c9d6be904c2ee3d55bf1a 100644 (file)
@@ -8,7 +8,7 @@ diff -Nuar tor-0.2.7.4-rc.orig/src/config/torrc.sample.in tor-0.2.7.4-rc/src/con
 +## Default username and group the server will run as
 +User tor
 +
-+PIDFile /var/run/tor/tor.pid
++PIDFile /run/tor/tor.pid
 +
  ## Tor opens a SOCKS proxy on port 9050 by default -- even if you don't
  ## configure one below. Set "SOCKSPort 0" if you plan to run Tor only
diff --git a/net-vpn/tor/files/tor.initd-r9 b/net-vpn/tor/files/tor.initd-r9
new file mode 100644 (file)
index 0000000..c1639c2
--- /dev/null
@@ -0,0 +1,37 @@
+#!/sbin/openrc-run
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+command=/usr/bin/tor
+pidfile=/run/tor/tor.pid
+command_args="--hush --runasdaemon 1 --pidfile \"${pidfile}\""
+retry=${GRACEFUL_TIMEOUT:-60}
+stopsig=INT
+command_progress=yes
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+description="Anonymizing overlay network for TCP"
+description_checkconfig="Check for valid config file"
+description_reload="Reload the configuration"
+
+checkconfig() {
+       ${command} --verify-config --hush > /dev/null 2>&1
+       if [ $? -ne 0 ] ; then
+               eerror "Tor configuration (/etc/tor/torrc) is not valid."
+               eerror "Example is in /etc/tor/torrc.sample"
+               return 1
+       fi
+}
+
+start_pre() {
+       checkconfig || return 1
+       checkpath -d -m 0755 -o tor:tor /run/tor
+}
+
+reload() {
+       checkconfig || return 1
+       ebegin "Reloading Tor configuration"
+       start-stop-daemon -s HUP --pidfile ${pidfile}
+       eend $?
+}
diff --git a/net-vpn/tor/files/torrc-r2 b/net-vpn/tor/files/torrc-r2
new file mode 100644 (file)
index 0000000..b308104
--- /dev/null
@@ -0,0 +1,7 @@
+#
+# Minimal torrc so tor will work out of the box
+#
+User tor
+PIDFile /run/tor/tor.pid
+Log notice syslog
+DataDirectory /var/lib/tor/data
index 0e4ac6b7343473ddc8ca3b20257062ae45a93770..4bb1f0d376b18f49e8afbffd668b7133ee27f79f 100644 (file)
@@ -75,7 +75,7 @@ src_install() {
        readme.gentoo_create_doc
 
        newconfd "${FILESDIR}"/tor.confd tor
-       newinitd "${FILESDIR}"/tor.initd-r8 tor
+       newinitd "${FILESDIR}"/tor.initd-r9 tor
        systemd_dounit contrib/dist/tor.service
 
        keepdir /var/lib/tor
@@ -84,5 +84,5 @@ src_install() {
        fowners tor:tor /var/lib/tor
 
        insinto /etc/tor/
-       newins "${FILESDIR}"/torrc-r1 torrc
+       newins "${FILESDIR}"/torrc-r2 torrc
 }
index e81cec3f97ec94377dd6e99887ad3907e9e1c0ff..ed9e10a6a652cc9c85ab84d6d8082207033a23e7 100644 (file)
@@ -77,7 +77,7 @@ src_install() {
        readme.gentoo_create_doc
 
        newconfd "${FILESDIR}"/tor.confd tor
-       newinitd "${FILESDIR}"/tor.initd-r8 tor
+       newinitd "${FILESDIR}"/tor.initd-r9 tor
        systemd_dounit contrib/dist/tor.service
 
        keepdir /var/lib/tor
@@ -86,5 +86,5 @@ src_install() {
        fowners tor:tor /var/lib/tor
 
        insinto /etc/tor/
-       newins "${FILESDIR}"/torrc-r1 torrc
+       newins "${FILESDIR}"/torrc-r2 torrc
 }