#!/bin/sh # Verify that tmpfiles only runs the boot-only entries, the ones with # a ! after the type, at boot or when called with --boot set -eu TEST_DIR=$(dirname "$0") DIR=/tmp/boot CONF=/tmp/boot.conf tmpfiles() { run "/libexec/finit/tmpfiles $* $CONF" } assert_exists() { assert "$1 exists" "$(texec sh -c "test -e $1 && echo yes || echo no")" = "$2" } test_teardown() { say "Running test teardown." run "rm -rf $DIR $CONF /fastboot" rm -f "$NOLOGIN" } # Removed at boot by an r! entry in Finit's own legacy.conf touch "${SYSROOT:-$(pwd)/$TEST_DIR/sysroot}/fastboot" # What systemd's own tmpfiles.d has, logins are refused until boot is done NOLOGIN="${SYSROOT:-$(pwd)/$TEST_DIR/sysroot}/etc/tmpfiles.d/nologin.conf" mkdir -p "$(dirname "$NOLOGIN")" echo 'f+! /run/nologin 0644 - - - "System is booting up."' > "$NOLOGIN" echo 'f! /run/nologin-ran' >> "$NOLOGIN" # shellcheck source=/dev/null . "$TEST_DIR/lib/setup.sh" sep say 'Finit runs the boot-only entries, and removes, at boot' assert_exists /fastboot no sep say 'Logins are let in again when boot is done' assert_exists /run/nologin-ran yes assert_exists /run/nologin no run "cat > $CONF" <