]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: add %y/%Y specifiers for the fragment path of the unit 22195/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Jan 2022 15:45:19 +0000 (16:45 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Jan 2022 07:00:41 +0000 (08:00 +0100)
commit607f032858dd1c123481e37d00391029c5b54001
tree790789ced94375525471a156979d4eaefd6b8c12
parent01c69460811f64e416c3e4a545ef84787bb6700b
core: add %y/%Y specifiers for the fragment path of the unit

Fixes #6308: people want to be able to link a unit file via 'systemctl enable'
from a git checkout or such and refer to other files in the same repo.
The new specifiers make that easy.

%y/%Y is used because other more obvious choices like %d/%D or %p/%P are
not available because at least on of the two letters is already used.

The new specifiers are only available in units. Technically it would be
trivial to add then in [Install] too, but I don't see how they could be
useful, so I didn't do that.

I added both %y and %Y because both were requested in the issue, and because I
think both could be useful, depending on the case. %Y to refer to other files
in the same repo, and %y in the case where a single repo has multiple unit files,
and e.g. each unit has some corresponding asset named after the unit file.
man/systemd.unit.xml
src/core/unit-printf.c
src/shared/specifier.c
src/shared/specifier.h
src/test/test-specifier.c