mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
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>
28 lines
548 B
Bash
Executable File
28 lines
548 B
Bash
Executable File
#!/bin/sh
|
|
# Verify that tmpfiles removes before it creates when asked to do both
|
|
set -eu
|
|
|
|
TEST_DIR=$(dirname "$0")
|
|
|
|
DIR=/tmp/order
|
|
CONF=/tmp/order.conf
|
|
|
|
test_teardown()
|
|
{
|
|
say "Running test teardown."
|
|
run "rm -rf $DIR $CONF"
|
|
}
|
|
|
|
# shellcheck source=/dev/null
|
|
. "$TEST_DIR/lib/setup.sh"
|
|
|
|
run "cat > $CONF" <<CONF
|
|
d $DIR
|
|
f $DIR/file - - - - new
|
|
r $DIR/file
|
|
CONF
|
|
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"
|