#!/bin/sh # Verify which tmpfiles.d files are read, in what order, and that the # first entry for a path is the one that counts set -eu TEST_DIR=$(dirname "$0") DIR=/tmp/files LIB=/usr/lib/tmpfiles.d ETC=/etc/tmpfiles.d test_teardown() { say "Running test teardown." run "rm -rf $DIR $LIB/[0-9]0-test.conf $ETC/[0-9]0-test.conf" } # shellcheck source=/dev/null . "$TEST_DIR/lib/setup.sh" run "mkdir -p $LIB $ETC" run "cat > $LIB/50-test.conf" < $ETC/50-test.conf" < $LIB/10-test.conf" < $ETC/20-test.conf" <&1 | grep -c 'already has an entry'")" = "1" sep say 'A file named - is read from standard input' run "echo 'f $DIR/stdin' | /libexec/finit/tmpfiles --create -" assert "Entry on stdin" "$(texec sh -c "ls $DIR | grep -c stdin")" = "1"