Commit Graph
3 Commits
Author SHA1 Message Date
Joachim Wiberg 86bb79d7a1 tmpfiles: create a path after those above it, glob entries last
An entry was run as its line was read, so the outcome followed the
order of the lines and of the files.  With

    f /var/run/app/file
    L /var/run - - - - ../run

the f entry made /var/run a directory, and the link was never made.
An entry like z or w, placed before the one that makes its path, found
nothing to change.

tmpfiles.d(5) has a path created after the paths above it and removed
after those below it, and runs the entries that take a glob after the
others.  Do the same.  Every entry is now read before the first one is
run, which also means a line is parsed once, not once per pass, and
the pass that only gathered the x and X entries is gone.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-11-21 19:23:48 +01:00
Joachim Wiberg ddb4f18fa9 tmpfiles: add --dry-run, to show what would be run
There was no way to see what the tmpfiles.d files on a system amount
to, short of running them:

    tmpfiles --dry-run --create --remove --boot

With -n or --dry-run each entry that would be run is printed, with
what would be done, remove, clean, or create, in the order it would
be.  Nothing is changed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-11-20 19:10:04 +01:00
Joachim Wiberg 9195d145d1 tmpfiles: remove before creating when asked to do both
With both --create and --remove each entry was removed and then
created before the next one was read.  An r entry took what an entry
above it had just created:

    f /tmp/file - - - - new
    r /tmp/file

    tmpfiles --create --remove t.conf

This left no /tmp/file.  The same goes for --clean.

Run all the files twice in that case, first to remove and clean, then
to create.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-11-20 18:02:34 +01:00