mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
81a183800f
Any file/directory created by a tmpfiles.d will be deleted. Useful for purge/factory reset patterns.
34 lines
613 B
Bash
Executable File
34 lines
613 B
Bash
Executable File
#!/bin/bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#
|
|
# Tests for the --purge switch
|
|
#
|
|
set -eux
|
|
set -o pipefail
|
|
|
|
export SYSTEMD_LOG_LEVEL=debug
|
|
|
|
systemd-tmpfiles --create - <<EOF
|
|
d /tmp/somedir
|
|
f /tmp/somedir/somefile - - - - baz
|
|
EOF
|
|
|
|
test -f /tmp/somedir/somefile
|
|
grep -q baz /tmp/somedir/somefile
|
|
|
|
systemd-tmpfiles --purge - <<EOF
|
|
d /tmp/somedir
|
|
f /tmp/somedir/somefile - - - - baz
|
|
EOF
|
|
|
|
test ! -f /tmp/somedir/somefile
|
|
test ! -d /tmp/somedir/
|
|
|
|
systemd-tmpfiles --create --purge - <<EOF
|
|
d /tmp/somedir
|
|
f /tmp/somedir/somefile - - - - baz
|
|
EOF
|
|
|
|
test -f /tmp/somedir/somefile
|
|
grep -q baz /tmp/somedir/somefile
|