tmpfiles: add --replace, files on the command line in place of one

A package script may run before the package's tmpfiles.d file is on
disk, and gives the entries on the command line or on standard input.
Then only those entries were read, so one that the admin has changed
in /etc/tmpfiles.d was run as the package has it.

With --replace=PATH all the tmpfiles.d files are read, and the ones on
the command line are read where the file PATH would be, as in
systemd-tmpfiles:

    tmpfiles --create --replace=/usr/lib/tmpfiles.d/app.conf -

They are not read at all when a later directory has a file of that
name, as with a file that is installed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 19:23:50 +01:00
1 parent fa430d0a02
commit 575267f09b
4 files changed
+99 -30

No files matched your search

+3
View File
@@ -61,6 +61,9 @@ All relevant changes are documented in this file.
`tmpfiles --dry-run` tells which entries are skipped
- tmpfiles: a file named `-` on the command line is read from standard
input
- tmpfiles: add `--replace=PATH`, to read all files with the ones on the
command line in place of the file `PATH`, as in systemd-tmpfiles. For
a package script that runs before the package's own file is installed
- tmpfiles: add `--prefix=PATH`, to only run the entries for paths below
it. `--prefix` and `--exclude-prefix` match whole path components,
`--exclude-prefix=/dev` no longer skips `/devices`