#801822 deb-systemd-helper does not support template units (e.g. foo@.service)

#801822#5
Date:
2015-10-14 22:28:25 UTC
From:
To:
`deb-systemd-helper enable foo@1.service` will not work even if the
corresponding foo@.service is correctly in place.

Use case: in the new version of debci, you will be able to run multiple
worker instances on each system, but by default I want to enable and
start the first one in postinst.

I hope I understand how all of this is supposed to work, so I am
currently doing it like this:

http://anonscm.debian.org/cgit/collab-maint/debci.git/commit/?id=cef32ff04680607a4e41a9673649e8320f649c95

Are we supposed to have packages managing instanciated template units
like this?

#801822#10
Date:
2016-12-21 21:10:20 UTC
From:
To:
Control: tags -1 confirmed

I can confirm deb-systemd-* do not support instanced templated units,
and this is a pretty big hole.
Patches to make it work welcome.

Saludos

#801822#17
Date:
2017-02-25 02:49:19 UTC
From:
To:
Hi there!

I wrote a backupscript for btrfs-filesystem and need to activate on
instantiated unit on several timer-units.

Manually
systemctl enable mkbackup@weekly.service mkbackup@daily.service
works.

But  deb-systemd-helper enable $SERVICE >/dev/null || true

But deb-systemd-helper gives me
/usr/bin/deb-systemd-helper: error: unable to read kbackup@daily.service
/usr/bin/deb-systemd-helper: error: unable to read kbackup@weekly.service
for this services.

regards

jakob

#801822#22
Date:
2017-02-25 03:32:54 UTC
From:
To:
Hi there!

I tried this
--- /usr/bin/deb-systemd-helper 2017-02-25 03:56:20.844471315 +0100 +++ /usr/bin/deb-systemd-helper-instantunits 2017-02-25 04:27:56.794876790 +0100 @@ -118,6 +118,7 @@ my ($scriptname) = @_; my $service_path = $scriptname; + $scriptname =~ s/\@.*\.([a-z]*)$/@.\1/; if (-f "/etc/systemd/system/$scriptname") { $service_path = "/etc/systemd/system/$scriptname"; } elsif (-f "/lib/systemd/system/$scriptname") { and now i can work with instantiated unit-files. Regards! Jakob
#801822#27
Date:
2017-02-25 03:35:58 UTC
From:
To:
Hi there!

I tried this
--- /usr/bin/deb-systemd-helper 2017-02-25 03:56:20.844471315 +0100 +++ /usr/bin/deb-systemd-helper-instantunits 2017-02-25 04:27:56.794876790 +0100 @@ -118,6 +118,7 @@ my ($scriptname) = @_; my $service_path = $scriptname; + $scriptname =~ s/\@.*\.([a-z]*)$/@.\1/; if (-f "/etc/systemd/system/$scriptname") { $service_path = "/etc/systemd/system/$scriptname"; } elsif (-f "/lib/systemd/system/$scriptname") { and now i can work with instantiated unit-files. Regards! Jakob
#801822#32
Date:
2017-03-22 23:03:53 UTC
From:
To:
I changed my Patch... Now it seems to work correct.
#801822#37
Date:
2022-02-03 15:44:28 UTC
From:
To:
I've opened a merge request on Salsa with another possible fix.
It works for me locally, but I would like any feedback if I made a mistake somewhere.

I've attached the patch as an attachment and the MR is at
https://salsa.debian.org/debian/init-system-helpers/-/merge_requests/20.

#801822#44
Date:
2022-07-11 12:59:48 UTC
From:
To:
Control: tags -1 - patch
The MR was merged, but I realise now that the original bug is about
manipulating instances of template units, which is not what my patch
addressed.

I've removed the patch tag from this bug report.

#801822#51
Date:
2023-07-11 14:52:59 UTC
From:
To:
Hi,

I am not sure if I understood everything properly.

I tried to fix this bug with this MR:
Support template units (!23) * Merge requests * Debian / init-system-helpers * GitLab<https://salsa.debian.org/debian/init-system-helpers/-/merge_requests/23>

Would be nice if someone with a better understanding of deb-systemd-helper could have a look.

Thanks
Manuel