control: retitle -1 tor: please provide runscript file -- second call
Hello, dear maintainer. This bug, requesting addition of runscript file into package was filed some time ago, and got no response. It is quite unfortunate, since your review of could have provided valuable advice how to improve proposed patch. But, after all, we all volonteers here. So hereby I inform you, following advice in Developer reference, section 5.11, that I plan to do non-maintainer upload in two weeks or so. Upload will be into DELAYED/15, so you still have plenty of time to make comments and take action. Thank you for your work on Debian. Best regards. Previous version of patch contained bug, that is fixed by patch below. Also, there is successful automatic check on Salsa¹ ¹ https://salsa.debian.org/kaction/tor-runscript/-/jobs/222478 From 1b139e7b57d725ef94851118bc010c81ecb932ce Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov <[email protected]> Date: Thu, 6 Jun 2019 10:00:28 +0000 Subject: [PATCH] Add integration for runit init --- debian/control | 3 +- debian/rules | 1 + debian/tor.install | 2 ++ debian/tor.runit | 1 + debian/tor.runscript/conf/MAX_FILEDESCRIPTORS | 1 + debian/tor.runscript/run | 32 +++++++++++++++++++ 6 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 debian/tor.runit create mode 100644 debian/tor.runscript/conf/MAX_FILEDESCRIPTORS create mode 100644 debian/tor.runscript/run diff --git a/debian/control b/debian/control index 74ba641..e240b05 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: tor Section: net Priority: optional Maintainer: Peter Palfrader <[email protected]> -Build-Depends: debhelper (>= 9.20160114), quilt, libssl-dev, zlib1g-dev, libevent-dev (>= 1.1), asciidoc (>= 8.2), docbook-xml, docbook-xsl, xmlto, dh-apparmor, libseccomp-dev [amd64 i386], dh-systemd [linux-any], libsystemd-dev [linux-any], pkg-config [linux-any], libcap-dev [linux-any], dh-autoreconf, liblzma-dev, libzstd-dev +Build-Depends: debhelper (>= 9.20160114), quilt, libssl-dev, zlib1g-dev, libevent-dev (>= 1.1), asciidoc (>= 8.2), docbook-xml, docbook-xsl, xmlto, dh-apparmor, libseccomp-dev [amd64 i386], dh-systemd [linux-any], libsystemd-dev [linux-any], pkg-config [linux-any], libcap-dev [linux-any], dh-autoreconf, liblzma-dev, libzstd-dev, dh-runit (>= 2.8.8) Build-Conflicts: libnacl-dev, libseccomp-dev [!amd64 !i386] Standards-Version: 3.9.8 Homepage: https://www.torproject.org/ @@ -14,6 +14,7 @@ Architecture: any Depends: ${shlibs:Depends}, adduser, ${misc:Depends}, lsb-base Pre-Depends: ${misc:Pre-Depends} Conflicts: libssl0.9.8 (<< 0.9.8g-9) +Breaks: ${runit:Breaks} Recommends: logrotate, tor-geoipdb, torsocks Suggests: mixmaster, torbrowser-launcher, socat, tor-arm, apparmor-utils, tor-arm, obfs4proxy Description: anonymizing overlay network for TCP diff --git a/debian/rules b/debian/rules index 710d166..22c093a 100755 --- a/debian/rules +++ b/debian/rules @@ -26,6 +26,7 @@ endif $@ \ --with quilt \ --with autoreconf \ + --with runit \ $(dhoptions) \ --builddirectory=build \ --parallel diff --git a/debian/tor.install b/debian/tor.install index 97da1ca..566d16a 100644 --- a/debian/tor.install +++ b/debian/tor.install @@ -11,3 +11,5 @@ debian/systemd/tor.service lib/systemd/system debian/systemd/[email protected] lib/systemd/system debian/systemd/[email protected] lib/systemd/system debian/systemd/tor-generator lib/systemd/system-generators + +debian/tor.runscript/conf/* /etc/tor/conf diff --git a/debian/tor.runit b/debian/tor.runit new file mode 100644 index 0000000..5ca5bca --- /dev/null +++ b/debian/tor.runit @@ -0,0 +1 @@ +debian/tor.runscript name=tor,logscript,since=0.3.5.8-1+runit diff --git a/debian/tor.runscript/conf/MAX_FILEDESCRIPTORS b/debian/tor.runscript/conf/MAX_FILEDESCRIPTORS new file mode 100644 index 0000000..252cb66 --- /dev/null +++ b/debian/tor.runscript/conf/MAX_FILEDESCRIPTORS @@ -0,0 +1 @@ +8192 diff --git a/debian/tor.runscript/run b/debian/tor.runscript/run new file mode 100644 index 0000000..bd7c126 --- /dev/null +++ b/debian/tor.runscript/run @@ -0,0 +1,32 @@ +#!/usr/bin/env /lib/runit/invoke-run +readonly daemon=/usr/bin/tor +exec 2>&1 + +# This directory is referenced in /usr/share/tor/tor-service-defaults-torrc +# and must exist. +readonly authdir=/run/tor +if test ! -d "${authdir}"; then + mkdir -m 02755 "${authdir}" + chown debian-tor:debian-tor "${authdir}" + ! [ -x /sbin/restorecon ] || /sbin/restorecon "${authdir}" +fi + +ulimit -n "${MAX_FILEDESCRIPTORS}" + +# default invocation +set -- "${daemon}" \ + --defaults-torrc /usr/share/tor/tor-service-defaults-torrc \ + -f /etc/tor/torrc \ + --Log 'notice stdout' \ + --RunAsDaemon 0 + +if ! "$@" --verify-config ; then + echo "persistent error: Tor configuration is not valid" + exec sv down tor +fi + +if aa-status --enabled ; then + set -- /usr/bin/aa-exec --profile=system_tor -- "$@" +fi + +exec /usr/bin/env -i "$@" -- Note, that I send and fetch email in batch, once in a few days. Please, mention in body of your reply when you add or remove recepients.

