tmpfiles: add the specifiers for the OS release and architecture

An entry with %a, or one of the specifiers that come from os-release,
was skipped as unsupported:

    d /var/lib/app/%o-%w 0755 - - -

Add %o, %w, %W, %B, %M, and %A, read from /etc/os-release with
/usr/lib/os-release as fallback, and %a with the names tmpfiles.d(5)
has for the architectures.  A field that os-release lacks gives an
empty string, as in tmpfiles.d(5).  An entry is still skipped when
the architecture is not one of those known.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:35:36 +01:00
1 parent bccd04d81d
commit fb3b13a245
6 files changed
+113 -22

No files matched your search

+3 -2
View File
@@ -17,8 +17,9 @@ All relevant changes are documented in this file.
at boot and no longer need a separate call
- tmpfiles: add the `%` specifiers of tmpfiles.d(5) for the path, and for
the argument of `C`, `f`, `F`, `L`, and `w` entries: `%b`, `%m`, `%H`,
`%l`, `%v`, the directories `%t`, `%T`, `%V`, `%S`, `%C`, `%L`, `%h`,
and the user ones `%u`, `%U`, `%g`, `%G`. Before, an entry with a `%`
`%l`, `%v`, `%a`, the directories `%t`, `%T`, `%V`, `%S`, `%C`, `%L`,
`%h`, the user ones `%u`, `%U`, `%g`, `%G`, and from os-release `%o`,
`%w`, `%W`, `%B`, `%M`, and `%A`. Before, an entry with a `%`
in the path was skipped. **Note:** a literal `%` in such an argument,
e.g. in a `w` entry for `core_pattern`, must now be written `%%`
- tmpfiles: the age of an entry can now have several units, as in
+3 -4
View File
@@ -23,10 +23,9 @@ For your convenience a set of *optional* plugins are available:
file systems must be writable for this plugin to work.
This plugin is a wrapper for the [tmpfiles.d(5)][] implementation that
Finit has. Capable but limited: no attributes or subvolumes, and
of the `%` specifiers not those for the OS release and architecture.
It runs `tmpfiles --create --remove --boot`, so entries marked
boot-only with a `!` are run here and at no other time.
Finit has. Capable but limited: no attributes or subvolumes. It
runs `tmpfiles --create --remove --boot`, so entries marked boot-only
with a `!` are run here and at no other time.
By default, `/lib/finit/tmpfiles.d` carries all the default .conf
files distributed with Finit. It is read first but can be overridden
+5 -12
View File
@@ -8,16 +8,7 @@ files or common packages already rely on, last what few will miss.
[tmpfiles.d(5)]: https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
1. Specifiers
-------------
Missing are the ones for the OS release and the architecture: `%a`,
`%A`, `%B`, `%M`, `%o`, `%w`, and `%W`. An entry with one of them is
skipped. `%T` and `%V` are always `/tmp` and `/var/tmp`, they do not
look at `$TMPDIR`.
2. Remaining types and modifiers
1. Remaining types and modifiers
--------------------------------
* `L?`, and `C+`, which is read as `C`
@@ -28,7 +19,7 @@ look at `$TMPDIR`.
* Quoted paths, a path with a space in it cannot be written
3. Command line
2. Command line
---------------
Missing options: `--prefix`, `--root`, `--replace`, `--dry-run`,
@@ -37,7 +28,7 @@ is the useful one, for packages that run `tmpfiles --create` on only
their own paths.
4. Smaller things
3. Smaller things
------------------
* Files are processed one directory at a time. tmpfiles.d(5) sorts
@@ -54,4 +45,6 @@ their own paths.
* A `w` entry with a glob that matches several paths writes its
argument only up to the first backslash for all but the first,
`write_arg()` cuts the argument up as it goes
* The `%T` and `%V` specifiers are always `/tmp` and `/var/tmp`, they
do not look at `$TMPDIR`
* `mksubsys()` in `src/util.c` is unused