On Mon, 09 Feb 2015 at 16:33:31 +0000, Simon McVittie wrote:
> If I was the maintainer, I'd go for option 2, Type=forking, which makes
> the systemd unit work even more like the init script does now -
> signalling readiness via the parent process exiting. I'll look into
> doing a patch at some point.
See attached. Tested successfully in a jessie 'standard' virtual machine
with and without dbus.
Regards,
S
diffstat for dnsmasq_2.72-2 dnsmasq_2.72-2.1
changelog | 11 +++++++++++
init | 2 +-
systemd.service | 9 ++++-----
3 files changed, 16 insertions(+), 6 deletions(-)
diff -u dnsmasq-2.72/debian/changelog dnsmasq-2.72/debian/changelog
--- dnsmasq-2.72/debian/changelog
+++ dnsmasq-2.72/debian/changelog
@@ -1,3 +1,14 @@
+dnsmasq (2.72-2.1) unstable; urgency=medium
+
+ * Non-maintainer upload
+ * debian/systemd.service: switch from Type=dbus to Type=forking.
+ dnsmasq does not depend on dbus, but Type=dbus systemd services cannot
+ work without it. (Closes: #769486, #776530)
+ - debian/init: when called with systemd-exec argument, let dnsmasq
+ go into the background, so Type=forking can detect when it is ready
+
+ -- Simon McVittie <[email protected]> Tue, 10 Feb 2015 00:06:11 +0000
+
dnsmasq (2.72-2) unstable; urgency=low
* Fix build in Debian-kFreeBSD. (closes: #763693)
diff -u dnsmasq-2.72/debian/init dnsmasq-2.72/debian/init
--- dnsmasq-2.72/debian/init
+++ dnsmasq-2.72/debian/init
@@ -294,7 +294,7 @@
chown dnsmasq:nogroup /var/run/dnsmasq || return 2
fi
# Enable DBus by default because we use DBus activation with systemd.
- exec $DAEMON --keep-in-foreground --enable-dbus \
+ exec $DAEMON --enable-dbus \
-x /var/run/dnsmasq/$NAME.pid \
${MAILHOSTNAME:+ -m $MAILHOSTNAME} \
${MAILTARGET:+ -t $MAILTARGET} \
diff -u dnsmasq-2.72/debian/systemd.service dnsmasq-2.72/debian/systemd.service
--- dnsmasq-2.72/debian/systemd.service
+++ dnsmasq-2.72/debian/systemd.service
@@ -2,8 +2,8 @@
Description=dnsmasq - A lightweight DHCP and caching DNS server
[Service]
-Type=dbus
-BusName=uk.org.thekelleys.dnsmasq
+Type=forking
+PIDFile=/var/run/dnsmasq/dnsmasq.pid
# Test the config file and refuse starting if it is not valid.
ExecStartPre=/usr/sbin/dnsmasq --test
@@ -12,9 +12,8 @@
# wrapper picking up extra configuration files and then execs dnsmasq
# itself, when called with the "systemd-exec" function.
#
-# It also adds the command-line flags
-# --keep-in-foreground --enable-dbus
-# to enable DBus by default because we use DBus activation.
+# It also adds the command-line flag --enable-dbus
+# to enable D-Bus by default.
#
ExecStart=/etc/init.d/dnsmasq systemd-exec