On 2014-05-11 Michael Biebl <bi...@debian.org> wrote: > Am 11.05.2014 10:13, schrieb Andreas Metzler: >> On 2013-09-25 Julian Andres Klode <j...@debian.org> wrote: [...] >>> dnsmasq currently does not enable its systemd unit in postinst. It should >>> probably use dh-systemd. [...]
>> Isn't this severity serious? I have just gone from sysv to systemd > Agreed, I bumped the severity accordingly. >> (using apt-get --purge install systemd-sysv), and was switched from >> dnsmasq enabled before the upgrade to dnsmasq disabled, completely >> breaking DNS resolution. > Simon, first of all, thanks for shipping a native .service file for > systemd. If you need help getting the service enabled (using > dh-systemd), please let us know. We are happy to assist you with this or > provide a patch. Hello, dnsmasq is packaged without debhelper, making this a little bit more work. However I have simply checked what dh_systemd /would/ do and have manually applied the changes to maintainerscripts and dependencies to come up with the the attached patch. Could you please doublecheck? Thanks, cu Andreas -- `What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.' `I sew his ears on from time to time, sure'
diff -u dnsmasq-2.70/debian/changelog dnsmasq-2.70/debian/changelog --- dnsmasq-2.70/debian/changelog +++ dnsmasq-2.70/debian/changelog @@ -1,3 +1,14 @@ +dnsmasq (2.70-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Enable dnsmasq systemd unit on install. Otherwise dnsmasq does not run on + fresh installations (without administrator handholding) and even worse it + is disabled on systems switching from sysv to systemd. Modify + postinst/postrm exactly as dh_systemd would, add dependency on + init-system-helpers. Closes: #724602 + + -- Andreas Metzler <ametz...@debian.org> Sun, 11 May 2014 15:27:50 +0200 + dnsmasq (2.70-2) unstable; urgency=low * Ensure daemon not stared if dnsmasq package has been removed, diff -u dnsmasq-2.70/debian/control dnsmasq-2.70/debian/control --- dnsmasq-2.70/debian/control +++ dnsmasq-2.70/debian/control @@ -8,7 +8,8 @@ Package: dnsmasq Architecture: all -Depends: netbase, dnsmasq-base(>= ${binary:Version}) +Depends: netbase, dnsmasq-base(>= ${binary:Version}), + init-system-helpers (>= 1.18~) Suggests: resolvconf Conflicts: resolvconf (<<1.15) Description: Small caching DNS proxy and DHCP/TFTP server diff -u dnsmasq-2.70/debian/postinst dnsmasq-2.70/debian/postinst --- dnsmasq-2.70/debian/postinst +++ dnsmasq-2.70/debian/postinst @@ -1,6 +1,22 @@ #!/bin/sh set -e +# Code copied from dh_systemd_enable ---------------------- +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask dnsmasq.service >/dev/null || true + +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled dnsmasq.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable dnsmasq.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state dnsmasq.service >/dev/null || true +fi +# End code copied from dh_systemd_enable ------------------ + if [ -x /etc/init.d/dnsmasq ]; then update-rc.d dnsmasq defaults 15 85 >/dev/null diff -u dnsmasq-2.70/debian/postrm dnsmasq-2.70/debian/postrm --- dnsmasq-2.70/debian/postrm +++ dnsmasq-2.70/debian/postrm @@ -6,0 +7,15 @@ + +# Code copied from dh_systemd_enable ---------------------- +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask dnsmasq.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge dnsmasq.service >/dev/null + deb-systemd-helper unmask dnsmasq.service >/dev/null + fi +fi +# End code copied from dh_systemd_enable ------------------