systemd unit: Respect default file
Martin Pitt
martin.pitt at ubuntu.com
Wed Jun 4 08:34:37 BST 2014
Package: brltty
Version: 5.0-2
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch utopic
Hello,
brltty's systemd unit unconditionally starts the service. This
mis-matches the behaviour of the init.d file which checks
RUN_BRLTTY in /etc/default/brltty. The attached debdiff adjusts the
unit to do the same. It's not pretty, but seems to work well enough.
In the long run this hackery should stop of course; systemd units are
rather fundamentally incompatible with the idea of enabling/disabling
units with a default file instead of using "update-rc.d
enable/disable" (which works for SysV init, systemd, and upstart). But
as long as we have these options in the default file they should be
respected.
Alternatively, to fix this bug it also seems fine to me to drop the
RUN_BRLTTY option altogether. This is a change which conceptually
affects a lot of Debian packages though, so perhaps should be
discussed on a wider scale (d-devel@?)
Thanks for considering,
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
-------------- next part --------------
diff -Nru brltty-5.0/debian/brltty.service brltty-5.0/debian/brltty.service
--- brltty-5.0/debian/brltty.service 2014-03-14 05:17:05.000000000 +0100
+++ brltty-5.0/debian/brltty.service 2014-06-04 08:56:01.000000000 +0200
@@ -10,14 +10,13 @@
[Service]
-Type=forking
PIDFile=/run/brltty.pid
-ExecStart=/sbin/brltty -q -P /run/brltty.pid
+ExecStart=/bin/sh -c "grep -sq '^ *RUN_BRLTTY=no' /etc/default/brltty || exec /sbin/brltty -f -q -P /run/brltty.pid"
TimeoutStartSec=5
TimeoutStopSec=10
-Restart=always
+Restart=on-failure
RestartSec=30
Nice=-10
diff -Nru brltty-5.0/debian/changelog brltty-5.0/debian/changelog
--- brltty-5.0/debian/changelog 2014-03-31 20:35:18.000000000 +0200
+++ brltty-5.0/debian/changelog 2014-06-04 08:58:01.000000000 +0200
@@ -1,3 +1,11 @@
+brltty (5.0-2ubuntu3) utopic; urgency=medium
+
+ * debian/brltty.service: Respect disabling of brltty in the /etc/default
+ file. Turn this into a "Type=simple" job by running in the foreground so
+ that the unit can tell apart "disabled" from "running". (LP: #1316804)
+
+ -- Martin Pitt <martin.pitt at ubuntu.com> Wed, 04 Jun 2014 08:56:22 +0200
+
brltty (5.0-2ubuntu2) trusty; urgency=medium
* No change rebuild to drop python3.3 compiled extension.
More information about the Pkg-systemd-maintainers
mailing list