aboutsummaryrefslogtreecommitdiffstats
path: root/community/tor/tor.initd
diff options
context:
space:
mode:
authorScrumpyJack <scrumpyjack@st.ilet.to>2016-06-27 10:17:05 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2016-07-04 11:42:28 +0200
commit2ff62bbb9f7b2c82a826d7b159c1bc482aa8f0bd (patch)
tree97c60fb3221dfe78cd7ccfda5db6125c81d5f676 /community/tor/tor.initd
parent00e8ff605f1c4f6386596f35f2a5287ff9b8bc55 (diff)
downloadaports-2ff62bbb9f7b2c82a826d7b159c1bc482aa8f0bd.tar.bz2
aports-2ff62bbb9f7b2c82a826d7b159c1bc482aa8f0bd.tar.xz
testing/[various]: move packages to community
Moves the packages listed below from the testing to the community repository after successfully testing of said packages. asciinema at calcurse cmus compton cpio dvd+rw-tools fortune fvwm geary h2o heirloom-mailx leafpad nedit nmh rover tor torsocks urlview vdesk w3m wbar xcalc xclock xeyes xkill
Diffstat (limited to 'community/tor/tor.initd')
-rw-r--r--community/tor/tor.initd61
1 files changed, 61 insertions, 0 deletions
diff --git a/community/tor/tor.initd b/community/tor/tor.initd
new file mode 100644
index 0000000000..95d02db5d7
--- /dev/null
+++ b/community/tor/tor.initd
@@ -0,0 +1,61 @@
+#!/sbin/openrc-run
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/Attic/tor.initd-r6,v 1.7 2015/03/20 12:46:13 blueness dead $
+
+extra_commands="checkconfig"
+extra_started_commands="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 -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 -f ${CONFFILE}
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ checkpath -d -m 0755 -o tor /var/run/tor
+ 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
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Tor"
+ start-stop-daemon --stop --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 --signal HUP --pidfile ${PIDFILE}
+ eend $?
+}
+