Control: tags -1 patch Attached is a patch to enable the systemd service file, and modify it to mimick the behavior of the current initscript.
>From e4bce313a44555f474989588d30ee38b48069210 Mon Sep 17 00:00:00 2001 From: Arto Jantunen <[email protected]> Date: Thu, 30 Apr 2015 13:56:43 +0300 Subject: [PATCH] Install and enable the systemd service file - Patch the included service file to closely match the initscript - Add build-dep on dh-systemd - Install the service file --- debian/control | 2 +- debian/patches/debianize-systemd-service | 39 ++++++++++++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 3 ++- debian/tor.dirs | 1 + 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 debian/patches/debianize-systemd-service diff --git a/debian/control b/debian/control index 76b8ce1..c5e1258 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 (>= 8.1.0~), quilt, libssl-dev, zlib1g-dev, libevent-dev (>= 1.1), binutils (>= 2.14.90.0.7), hardening-includes, asciidoc (>= 8.2), docbook-xml, docbook-xsl, xmlto, dh-apparmor, libseccomp-dev [amd64 i386] +Build-Depends: debhelper (>= 8.1.0~), quilt, libssl-dev, zlib1g-dev, libevent-dev (>= 1.1), binutils (>= 2.14.90.0.7), hardening-includes, asciidoc (>= 8.2), docbook-xml, docbook-xsl, xmlto, dh-apparmor, libseccomp-dev [amd64 i386], dh-systemd Build-Conflicts: libnacl-dev, libseccomp-dev [!amd64 !i386] Standards-Version: 3.9.4 Homepage: https://www.torproject.org/ diff --git a/debian/patches/debianize-systemd-service b/debian/patches/debianize-systemd-service new file mode 100644 index 0000000..769efeb --- /dev/null +++ b/debian/patches/debianize-systemd-service @@ -0,0 +1,39 @@ +From: Arto Jantunen <[email protected]> +Date: Wed, 29 Apr 2015 19:27:02 +0300 +Subject: Debianize systemd service file + +--- + contrib/dist/tor.service.in | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/contrib/dist/tor.service.in b/contrib/dist/tor.service.in +index c251158..578bf39 100644 +--- a/contrib/dist/tor.service.in ++++ b/contrib/dist/tor.service.in +@@ -3,10 +3,11 @@ Description = Anonymizing overlay network for TCP + After = syslog.target network.target nss-lookup.target + + [Service] +-Type = notify +-NotifyAccess = all +-ExecStartPre = @BINDIR@/tor -f @CONFDIR@/torrc --verify-config +-ExecStart = @BINDIR@/tor -f @CONFDIR@/torrc ++Type = forking ++PIDFile = /var/run/tor/tor.pid ++EnvironmentFile=-/etc/default/tor ++ExecStartPre = @BINDIR@/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc --verify-config ++ExecStart = @BINDIR@/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc $ARGS + ExecReload = /bin/kill -HUP ${MAINPID} + KillSignal = SIGINT + TimeoutSec = 30 +@@ -22,8 +23,8 @@ ProtectSystem = full + ReadOnlyDirectories = / + ReadWriteDirectories = -@LOCALSTATEDIR@/lib/tor + ReadWriteDirectories = -@LOCALSTATEDIR@/log/tor +-NoNewPrivileges = yes +-CapabilityBoundingSet = CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE ++ReadWriteDirectories = -@LOCALSTATEDIR@/run/tor ++CapabilityBoundingSet = CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE CAP_DAC_OVERRIDE CAP_CHOWN CAP_FOWNER + + [Install] + WantedBy = multi-user.target diff --git a/debian/patches/series b/debian/patches/series index 19e8864..b267a32 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ improve-geoip-warning +debianize-systemd-service diff --git a/debian/rules b/debian/rules index d404e19..2bf6b9b 100755 --- a/debian/rules +++ b/debian/rules @@ -15,7 +15,7 @@ endif %: dh \ $@ \ - --with quilt \ + --with quilt,systemd \ --builddirectory=build \ --parallel @@ -52,6 +52,7 @@ override_dh_install: cp debian/tor.apparmor-profile debian/tor/etc/apparmor.d/system_tor cp debian/tor.apparmor-profile.abstraction debian/tor/etc/apparmor.d/abstractions/tor dh_apparmor --profile-name=system_tor -ptor + cp build/contrib/dist/tor.service debian/tor/lib/systemd/system override_dh_installdocs: dh_installdocs -ptor-dbg --link-doc=tor diff --git a/debian/tor.dirs b/debian/tor.dirs index f693956..7c82b44 100644 --- a/debian/tor.dirs +++ b/debian/tor.dirs @@ -1 +1,2 @@ etc/apparmor.d/abstractions +lib/systemd/system -- 2.1.4
-- Arto Jantunen

