On Do, 26.12.19 07:46, Jeffrey Walton (noloa...@gmail.com) wrote:

> Hi Everyone,
> My program package includes a systemd timer and service. I was able to
> setup my Makefile for a regular install using the daemons web page
> (https://www.freedesktop.org/software/systemd/man/daemon.html).
> My question is, how should I handle a staged install using DESTDIR?
> Specifically, should we expect the timer and service to be enabled in
> the staged directory? Should we expect the timer to be started in the
> directory?
> The relevant pieces of my current GNUmakefile is shown below. I'm not
> sure about these bits during a staged install:
>     systemctl enable callboot-update.service
>     systemctl enable callboot-update.timer
>     systemctl start callboot-update.timer

As the others on this thread already indicated, it doesn't sound like
a good idea to do this at all. But, if you ignore that and still want
to do that, then my recommendation to give this a somewhat
pseudo-"atomic" behaviour, consider doing it like this:

systemctl preset --no-reload callboot-update.service
systemctl preset --no-reload callboot-update.timer
systemctl daemon-reload
systemctl start callboot-update.timer

i.e. by specifiy "--no-reload" you make sure systemd won't reload the
units after each configuraiton you make. The "daemon-reload" after
that then makes systemd actually do the reload once taking all
configuration changes into account.

(There are alternative, and better approaches to this btw, for example
you could just do as before, but in one line, or you could tweak the
[Install] section to just enable both together always anyway, so that
you need to enable only one unit anyway).

Moreover use "preset" instead of "enable" at least, so that your
distro's/admin's preset policy is at least honoured.

Anyway, you still shouldn't do that from makefiles I am sure.


Lennart Poettering, Berlin
systemd-devel mailing list

Reply via email to