tmpfiles: add --purge and the $ modifier

When a package is removed, the state its tmpfiles.d file made is left
behind, there was no way to ask for it to be removed.

systemd-tmpfiles has --purge for that, which removes what the entries
marked with a $ after the type make:

    d$ /var/lib/app 0750 app app
    tmpfiles --purge /usr/lib/tmpfiles.d/app.conf

Add the same.  It only takes the entries of files on the command line,
never all of the tmpfiles.d files, and a path is removed before the
one above it.  A $ was until now read and ignored.

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 575267f09b
commit 26568bc0fd
5 files changed
+104 -4

No files matched your search

+3
View File
@@ -64,6 +64,9 @@ All relevant changes are documented in this file.
- 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 `--purge` and the `$` modifier, as in systemd-tmpfiles.
`tmpfiles --purge FILE` removes what the entries of `FILE` that are
marked with a `$`, as in `d$`, make. For when a package is removed
- 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`
+1 -1
View File
@@ -17,4 +17,4 @@ files or common packages already rely on, last what few will miss.
2. Command line
---------------
Missing options: `--root` and `--purge`.
Missing option: `--root`.