mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles.d(5) has h to set file attributes, as chattr(1) does, and H
for the path and everything below it:
h /var/log/journal - - - - +C
tmpfiles skipped them as unsupported.
Add both. The argument is the letters chattr(1) has, after a + to
add them, which is the default, a - to remove them, or a = to have
just these set. Only files and directories have such attributes,
anything else is left alone.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
37 lines
904 B
Bash
Executable File
37 lines
904 B
Bash
Executable File
#!/bin/sh
|
|
# Verify that tmpfiles skips an entry it does not support, and goes on
|
|
# with the rest
|
|
set -eu
|
|
|
|
TEST_DIR=$(dirname "$0")
|
|
|
|
DIR=/tmp/unsupported
|
|
CONF=/tmp/unsupported.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
|
|
y $DIR - - - - +i
|
|
f $DIR/%!
|
|
f $DIR/after
|
|
CONF
|
|
|
|
say 'Create only'
|
|
msg=$(texec sh -c "/libexec/finit/tmpfiles --create $CONF 2>&1")
|
|
assert "The entry after is created" "$(texec ls $DIR)" = "after"
|
|
assert "Each is reported once" "$(echo "$msg" | grep -c skipping)" -eq 2
|
|
|
|
say 'Remove and create, two passes'
|
|
run "rm $DIR/after"
|
|
msg=$(texec sh -c "/libexec/finit/tmpfiles --create --remove $CONF 2>&1")
|
|
assert "The entry after is created" "$(texec ls $DIR)" = "after"
|
|
assert "Each is reported once" "$(echo "$msg" | grep -c skipping)" -eq 2
|