tmpfiles: add the % specifiers for path and argument

An entry with a % in the path was skipped, and files from
distributions have them:

    d /run/log/journal/%m 2755 root systemd-journal - -

Expand the specifiers that do not need the OS release or the
architecture: %b, %m, %H, %l, %v, the directories %t, %T, %V, %S, %C,
%L, %h, and the user ones %u, %U, %g, %G.  tmpfiles runs as root, so
the last ones are fixed.  An entry with any other specifier is still
skipped.

The argument of C, f, F, L, and w entries is expanded too, as in
tmpfiles.d(5).  A literal % in such an argument must from now on be
written %%.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:03:33 +01:00
1 parent 83f4dceb1b
commit b87d235cf7
9 files changed
+176 -15

No files matched your search

+6
View File
@@ -15,6 +15,12 @@ All relevant changes are documented in this file.
skipped unless the new `--boot` option is given. Finit gives it at
boot, and now also `--remove`, so `r`, `R`, and `D` entries take effect
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 `%`
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 `v`, `q`, and `Q` entries now make a plain directory, like
`d`. Finit has no support for btrfs subvolumes, and before the entries
were skipped as unsupported
+1 -1
View File
@@ -28,7 +28,7 @@ Features
* [Conditions](conditions.md) for network/process/custom dependencies
* [Readiness notification](config/service-sync.md); PID files (native) for synchronizing system
startup, support for systemd [sd_notify()][], or [s6 style][] too
* Limited support for [tmpfiles.d(5)][] (no attributes, subvolumes, or specifiers)
* Limited support for [tmpfiles.d(5)][] (no attributes or subvolumes)
* [Pre/Post script actions](config/service-wrappers.md)
* Rudimentary [templating support](config/templating.md)
* [Tooling](initctl.md) to enable/disable services
+4 -3
View File
@@ -23,9 +23,10 @@ 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, subvolumes, or
specifiers. 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, 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.
By default, `/lib/finit/tmpfiles.d` carries all the default .conf
files distributed with Finit. It is read first but can be overridden
+7 -5
View File
@@ -24,11 +24,10 @@ user to call it from cron.
2. Specifiers
-------------
A path with `%` in it is skipped, also the escaped `%%`. The ones that
show up in files from distributions are `%b` (boot ID), `%m` (machine
ID), `%H` (hostname), `%v` (kernel release), and for the argument `%T`
and `%V`. This is the largest gap for using such files unchanged, and
the most work.
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`.
3. Remaining types and modifiers
@@ -64,4 +63,7 @@ their own paths.
* A `d` or `e` entry for a path that is a link to a directory warns
that mode and owner could not be set
* An age so large that it overflows is not caught
* 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
* `mksubsys()` in `src/util.c` is unused