Am 22.07.2014 14:34, schrieb Gerrit Pape: > On Fri, Jul 18, 2014 at 12:03:41PM +0000, Gerrit Pape wrote: >> I'm really not keen to add a dependency to daemontools-run, esp. not to >> the runit package, just for (un)installing and starting/stopping a >> service. > > Hi, I've now prepared this changeset. Do you have any comments on it? > > > Author: Gerrit Pape <p...@smarden.org> > Date: Tue Jul 22 12:26:42 2014 +0000 > > * debian/systemd/daemontools.path, debian/systemd/daemontools.service: > new; daemontools-run systemd unit files (thx Michael Biebl, Jonathan > de > Boyne Pollard, Milan P. Stanic). > * debian/rules: install daemontools-run systemd unit files. > * debian/daemontools-run.postinst, debian/daemontools-run.postrm: enable > and start, disable and stop respectively daemontools units if systemd > is process 1. > > diff --git a/debian/changelog b/debian/changelog > index 8d124f4..d2d4efc 100644 > --- a/debian/changelog > +++ b/debian/changelog > @@ -1,3 +1,15 @@ > +daemontools (1:0.76-3.1) UNRELEASED; urgency=low > + > + * debian/systemd/daemontools.path, debian/systemd/daemontools.service: > + new; daemontools-run systemd unit files (thx Michael Biebl, Jonathan de > + Boyne Pollard, Milan P. Stanic). > + * debian/rules: install daemontools-run systemd unit files. > + * debian/daemontools-run.postinst, debian/daemontools-run.postrm: enable > + and start, disable and stop respectively, daemontools units if systemd > + is process 1. > + > + -- Gerrit Pape <p...@smarden.org> Tue, 22 Jul 2014 14:00:45 +0200 > + > daemontools (1:0.76-3) unstable; urgency=low > > * debian/daemontools-run.postinst: don't exec into the kill program, so > diff --git a/debian/daemontools-run.postinst b/debian/daemontools-run.postinst > index d51ac09..1d7aae1 100644 > --- a/debian/daemontools-run.postinst > +++ b/debian/daemontools-run.postinst > @@ -74,3 +74,7 @@ if ! grep '^SV:' /etc/inittab >/dev/null; then > mv -f /etc/inittab'{new}' /etc/inittab > kill -s HUP 1 > fi > +if test "$(readlink /sbin/init || :)" = /lib/systemd/systemd; then > + systemctl enable -f daemontools.path > + systemctl start daemontools.path > +fi
The canonical check if systemd is PID 1 is "test -d /run/systemd/system" That said, the logic you added is incomplete/broken in several ways: The user first installs daemontools-run, later on systemd => the daemon-tools service will not be enabled The user deinstalls systemd. Later on he deinstalls daemontools-run => the symlinks will not be cleaned up. The systemctl enable call is run on every update. => If the admin has disabled the service, it will be re-enabled I didn't look further. There are probably more cases your maintainer scripts don't handle correctly. There is a reason, why we added the logic in a single place. -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
signature.asc
Description: OpenPGP digital signature