On Mon, 01 Aug 2016 19:07:09 +0200, gregor herrmann wrote: > > Package: dh-systemd > > [...] > > Description-en: debhelper add-on to handle systemd unit files > > dh-systemd provides a debhelper sequence addon named 'systemd' and the > > dh_systemd_enable/dh_systemd_start commands. > > . > > The dh_systemd_enable command adds the appropriate code to the > > postinst, prerm and postrm maint scripts to properly enable/disable > > systemd service files. > > The dh_systemd_start command deals with start/stop/restart on upgrades > > for systemd-only service files. > > I've been wading through the documentation and code of > /usr/share/perl5/Debian/Debhelper/Sequence/systemd.pm and > /usr/bin/dh_systemd_enable and > /usr/share/debhelper/autoscripts/postinst-systemd-enable - and > interesting the snippet doesn't end up in the postinst. Hm.
I think I found the reason: /usr/share/perl5/Debian/Debhelper/Sequence/systemd.pm adds dh_systemd_enable before dh_installinit but at that point the systemd service file is not yet installed (maybe because of the name [iodine != iodined]?), it gets installed later by dh_installinit ... If I install it beforehand: --- a/debian/iodine.install +++ b/debian/iodine.install @@ -1 +1,2 @@ debian/iodine-client-start usr/sbin +debian/iodined.service lib/systemd/system/ then dh_systemd_enable finds it and adds its snippets to the maintainer scripts. But then it gets funny again, due to those snippets: > > - The postinst script runs 'systemctl enable iodined.service' > > upon installation, and I think this could be done conditionally > > based on the contents of the enable/disable env variable in > > the /etc/default file. I'm not sure how to influence the automatically inserted parts ... > But I also started looking at deb-systemd-helper (in > init-system-helpers) and found an interesting example: > > https://sources.debian.net/src/isatapd/0.9.7-2/debian/postinst/?hl=12#L12 So where I'm now is that I can insert something with deb-systemd-helper (before or after the automatically addedd stuff), with the results: + the systemd service is masked (if I add the code _after_ 'DEBHELPER#) - there's still a failing attempt to start iodined + installing the new package succeeds So better than before. (Purging and dpkg-reconfiguring seem to the the right thing. Nice.) Here's the diff in case someone wants to check/try: #v+ diff --git a/debian/iodine.install b/debian/iodine.install index 5a7cdea..93e3582 100644 --- a/debian/iodine.install +++ b/debian/iodine.install @@ -1 +1,2 @@ debian/iodine-client-start usr/sbin +debian/iodined.service lib/systemd/system/ diff --git a/debian/iodined.service b/debian/iodined.service index 6da65c2..750d3e9 100644 --- a/debian/iodined.service +++ b/debian/iodined.service @@ -5,7 +5,6 @@ Documentation=man:iodined(8) [Service] EnvironmentFile=/etc/default/iodine -ExecStartPre=/bin/sh -xc "test ${START_IODINED} = true" ExecStart=/usr/sbin/iodined -f -u iodine -t /var/run/iodine $IODINED_ARGS -P ${IODINED_PASSWORD} Restart=on-failure Type=simple diff --git a/debian/postinst b/debian/postinst index 3591e21..45ffaee 100644 --- a/debian/postinst +++ b/debian/postinst @@ -90,4 +90,12 @@ db_stop; #DEBHELPER# +# mask iodined.service if START_IODINED is not set to true +# this mimicks the behaviour of sysvinit. cf. #832599 +if [ "$1" = "configure" ] ; then + if [ "$START_IODINED" != "true" ] ; then + deb-systemd-helper mask iodined.service >/dev/null || true + fi +fi + exit 0 #v- Cheers, gregor -- .''`. Homepage https://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: Der Junge mit der Gitarre: Feuer
signature.asc
Description: Digital Signature