On Tue, Jul 27, 2021 at 05:30:24PM +0200, Fabio Valentini wrote:
Hi everybody,
I have a package (syncthing [0]) that provides both system and user
units, depending on how the user wants the service to start. The user
units are obviously specific to each user, but the system units are
templates that are instantiated for the user who wants to have the
service run at boot.
Now, this is the problem: I do not know how to adapt the systemd
scriptlets [1] for this. Wildcards are not supported, and systemd on
Fedora 34+ now warns when encountering such wildcards, so the way it's
done in the syncthing package right now is not correct (as reported on
BugZilla [2]).
Glob pattern passed, but globs are not supported for this.
Invalid unit name "syncthing(a)*.service" escaped as
"syncthing(a)\x2a.service".
I'll copy my reply from the bug:
This is an omission from my side. The easiest solution (longer-term)
is to allow such globs in systemd. I filed a simple patch to do this
[1]. When it goes through, I'll push it to F34+ where the new
scriptlet is used
[1]
https://github.com/systemd/systemd/pull/20334
Does anybody know the correct way to handle this? Obviously those
system units can't (and shouldn't) be enabled for all users on update
or install, but I still want all service instances to be restarted on
update. The systemd scriptlet Guidelines do not cover this scenario at
all.
Short reply:
https://fedoraproject.org/wiki/Changes/Restart_User_Service_after_Upgrade
I hope I could convince people to do this for F35…
It sounds like it would be very useful for the syncthing case.
Zbyszek