mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
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>
This commit is contained in:
5 files changed
+47
-5
No files matched your search
@@ -25,3 +25,14 @@ run "mkdir $DIR; echo old > $DIR/file"
|
||||
run "/libexec/finit/tmpfiles --create --remove $CONF"
|
||||
|
||||
assert "The old file is removed, a new one created" "$(texec cat $DIR/file)" = "new"
|
||||
|
||||
sep
|
||||
say 'With --dry-run it only tells what it would do, in that order'
|
||||
run "cat > $CONF" <<CONF
|
||||
f $DIR/dry - - - - text
|
||||
r $DIR/file
|
||||
d $DIR/sub - - - 1d
|
||||
CONF
|
||||
out=$(texec /libexec/finit/tmpfiles --dry-run --create --remove --clean "$CONF")
|
||||
assert "What it would do" "$(echo "$out" | tr '\n' ';')" = "remove r $DIR/file;clean d $DIR/sub, older than 1d;create f $DIR/dry text;create d $DIR/sub;"
|
||||
assert "Nothing is done" "$(texec ls $DIR)" = "file"
|
||||
Reference in new issue
Block a user