[systemd-devel] How to handle staged installs with a Systemd unit?
Mantas Mikulėnas
grawity at gmail.com
Thu Dec 26 14:35:42 UTC 2019
On Thu, Dec 26, 2019 at 2:46 PM Jeffrey Walton <noloader at 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?
>
AFAIK, a staged install with $DESTDIR usually means that you're preparing
the files to be collected into a package -- usually to be installed on
another system and/or at a later time. So it doesn't make practical sense
to start anything at this point.
(And honestly I would **never** expect a Makefile to start any services
**at all**. Doesn't matter whether it's staged or not: that is simply not
what `make install` does.)
It also doesn't make much sense to call `systemctl enable`, as it's mainly
a sysadmin tool. Some distros automatically enable & start services after
package installation... but in that case the "enabled" status is still
under control by the sysadmin -- it is not hardcoded in the package itself.
(Side note: If you *do* want to preset the "enabled" status, you can
actually do this without `systemctl enable` by creating the same symlink
under /etc or under /usr/lib that the command's output shows.)
So in short I would suggest:
* Staged install: Do *nothing* except for installing the files.
* Non-staged install: Enable the service if you really need to (or create
the .wants symlink by hand), but do not start it.
--
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20191226/5fd87e19/attachment.htm>
More information about the systemd-devel
mailing list