diff options
author | Francesco Colista <fcolista@alpinelinux.org> | 2015-05-22 09:59:02 +0000 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2015-05-22 09:59:02 +0000 |
commit | 2e9499059aa562faaa34380d892b5b122e65e305 (patch) | |
tree | 83022ad87f889b16edb701462109de4f3c2df96c | |
parent | d52f3e9ceea7adfdbdb7c71309f09946dec74a3f (diff) | |
download | aports-2e9499059aa562faaa34380d892b5b122e65e305.tar.bz2 aports-2e9499059aa562faaa34380d892b5b122e65e305.tar.xz |
testing/tor: fixes #4217
-rw-r--r-- | testing/tor/APKBUILD | 20 | ||||
-rw-r--r-- | testing/tor/tor.confd | 8 | ||||
-rw-r--r-- | testing/tor/tor.initd | 67 |
3 files changed, 61 insertions, 34 deletions
diff --git a/testing/tor/APKBUILD b/testing/tor/APKBUILD index a88da8bd3..f8d95c6b8 100644 --- a/testing/tor/APKBUILD +++ b/testing/tor/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Sam Dodrill <shadow.h511@gmail.com> pkgname=tor pkgver=0.2.6.7 -pkgrel=0 +pkgrel=1 pkgdesc="Anonymous network connectivity" url="https://www.torproject.org" arch="all" @@ -13,8 +13,7 @@ depends_dev="bash libevent-dev openssl-dev ca-certificates" makedepends="$depends_dev" install="$pkgname.pre-install" subpackages="$pkgname-doc" -source=" - https://www.torproject.org/dist/$pkgname-$pkgver.tar.gz +source="https://www.torproject.org/dist/$pkgname-$pkgver.tar.gz tor.initd tor.confd " @@ -48,7 +47,8 @@ package() { cd "$_builddir" make DESTDIR="$pkgdir" install || return 1 rm -f "$pkgdir"/usr/lib/*.la - + mkdir -p "$pkgdir"/var/lib/$pkgname + chown $pkgusers "$pkgdir"/var/lib/$pkgname install -m755 -D "$srcdir"/$pkgname.initd \ "$pkgdir"/etc/init.d/$pkgname || return 1 install -m644 -D "$srcdir"/$pkgname.confd \ @@ -56,11 +56,11 @@ package() { } md5sums="a43b4dc6a95d219927aab0a2bb7ed322 tor-0.2.6.7.tar.gz -a751084ac153270c03a3a5b02a337999 tor.initd -cbcac88f5b728b1441891947a4babbcb tor.confd" +c10b84a88dfaff4c17e40d04edd2caf3 tor.initd +e05a796ffc4981c22c167de11fa36ef9 tor.confd" sha256sums="8c2be88a542ed1b22a8d3d595ec0acd0e28191de273dbcaefc64fdce92b89e6c tor-0.2.6.7.tar.gz -17340bc8f05632082b0c25e3deeff9836eeea412786ad525b5900d9cb083d3a9 tor.initd -7d9e1125577252206d09e43c387fcfd8996115b46ac5d7f6ca3e46ef47316e98 tor.confd" +6b1fbc73e108e42a57a0faba409cb5fc6b40d79897261753cc4bc076faf23c35 tor.initd +41d780f291847e19f632428bbf27c3f289414afd237546d2974da1b75384c25c tor.confd" sha512sums="96e3cb5bcafddb1655663091ecf08f708213e47529d9701d67256e88d5fc2e70acffc6c062df6b8f0f4a4e3ef3d0dda76b5127ef9eeee06371ce0a66e53815b0 tor-0.2.6.7.tar.gz -7ee767caaa874bd8b8b102ab93b08138aaebf0fee396e530bd89b4e1c982c617a6647c438a0c80c3da2a33fc24085336c2d3c87359774d89b7901cdaa02ad237 tor.initd -f11f0d192cd7823307c2ce4ddc7b3fff5190f72d3f65a5524b487021a95a222aca1fd36ab1eb58ed533e7acd555bfb70f0c8a13db20338ea31527f3151fd2bd7 tor.confd" +baec0ffcbab334582aedeb2869a92862c45a379b3a71fe99b296732713ef3026adab181fccb7304bc0830f8ab72ac811b6fcbe91d739e8b78e41f515e920a0ea tor.initd +9028ac41e3acdf4405095addb69537e87edecafaec840296ac27a5a8992fe132dc822e4e4abb8826f76460c438da2719dea17859690d03e17198a82086a3d660 tor.confd" diff --git a/testing/tor/tor.confd b/testing/tor/tor.confd index 486252b03..4195bf323 100644 --- a/testing/tor/tor.confd +++ b/testing/tor/tor.confd @@ -1,7 +1,3 @@ -# Sample conf.d file for alpine linux - # -# Specify daemon options here. -# - -sample_opts="" +# Set the file limit +rc_ulimit="-n 30000" diff --git a/testing/tor/tor.initd b/testing/tor/tor.initd index 4a26c1dad..95d02db5d 100644 --- a/testing/tor/tor.initd +++ b/testing/tor/tor.initd @@ -1,30 +1,61 @@ -#!/sbin/runscript +#!/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 $ -# Sample init.d file for alpine linux. +extra_commands="checkconfig" +extra_started_commands="reload" -name=tor -daemon=/usr/bin/$name +PIDFILE=/var/run/tor/tor.pid +CONFFILE=/etc/tor/torrc depend() { - need net - after firewall - provide $name + 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() { - ebegin "Starting ${name}" - start-stop-daemon --start --quiet \ - --pidfile /var/run/${name}.pid \ - -u ${name} \ - --exec ${daemon} -- --runasdaemon 1 - eend $? + 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 ${name}" - start-stop-daemon --stop --quiet \ - --pidfile /var/run/$name.pid \ - --exec ${daemon} - eend $? + 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 $? } |