#!/bin/sh # Verify the C and C+ entries of tmpfiles, copy a file or a tree set -eu TEST_DIR=$(dirname "$0") DIR=/tmp/copy SRC=/tmp/copy-src CONF=/tmp/copy.conf content() { texec sh -c "cat $1 2>/dev/null || echo none" } test_teardown() { say "Running test teardown." run "rm -rf $DIR $SRC $CONF" } # shellcheck source=/dev/null . "$TEST_DIR/lib/setup.sh" run "mkdir -p $SRC/sub $DIR/empty $DIR/full/sub $DIR/merge/sub" run "echo new > $SRC/file; echo new > $SRC/sub/file; echo new > $SRC/sub/other; ln -s file $SRC/link; chmod 640 $SRC/file" run "echo old > $DIR/full/file; echo old > $DIR/merge/sub/file; echo old > $DIR/one-old" run "mkdir $SRC/away $DIR/out; echo new > $SRC/away/file; ln -s ../out $DIR/merge/away" run "cat > $CONF" <