dh_systemd_enable and instances of unit-file templates
Hi,
I'm packaging a logging service for buster. Users typically only need to
run one instance but power users might want to run multiple instances.
This sounds like a perfect use case for systemd templates [1] to me.
However, I'm struggling to get my package to install + enable + start a
default instance (ioclogserver@default.service) of a service template
(ioclogserver@.service).
I started by naïvely providing debian/ioclogserver@.service as part of
my package. Unfortunately, this file only gets installed but neither
enabled nor started. I can manually do so after installing the package
by running
systemctl enable mylogger@.service *
systemctl start mylogger@default.service
*This works since I have specified "DefaultInstance=default" in the
template's "[Install]" section.
I tried to encourage dh_systemd_enable to enable my template automatically:
override_dh_systemd_enable:
dh_systemd_enable ioclogserver@.service
Apparently dh_systemd_enable ignores templates, though. So I tried
specifying an instance
override_dh_systemd_enable:
dh_systemd_enable ioclogserver@default.service
This fails ('dh_systemd_enable: Requested unit
"ioclogserver@default.service" but it was not found in any package acted
on.').
I tried to provide ioclogserver@default.service explicitly which fixed
the error above. Still no luck, though: dh_systemd_enable doesn't
install this file so I had to add it to ioclogserver.install. That takes
care of the installation part but it's still not being considered by
dh_systemd_enable...
It seems like I'm not the first one running into this limitation of
debhelper [2]. I'm wondering if there's a way I can work around this
until [2] has been addressed. Or am I trying to accomplish something
that I'm not supposed to do in the first place?
Thanks,
Martin
[1]
https://www.freedesktop.org/software/systemd/man/systemd.service.html#Service%20Templates
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=889635
Reply to: