]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/test-execute/exec-temporaryfilesystem-ro.service
Merge pull request #30844 from keszybz/rename-uid-alloc-range
[thirdparty/systemd.git] / test / test-execute / exec-temporaryfilesystem-ro.service
CommitLineData
22d3cfe5 1# SPDX-License-Identifier: LGPL-2.1-or-later
4cac89bd
YW
2[Unit]
3Description=Test for TemporaryFileSystem with read-only mode
4
5[Service]
6Type=oneshot
7
8# Check directories exist
63403f07 9ExecStart=sh -c 'test -d /var/test-exec-temporaryfilesystem/rw && test -d /var/test-exec-temporaryfilesystem/ro'
4cac89bd
YW
10
11# Check TemporaryFileSystem= are empty
63403f07 12ExecStart=sh -c 'for i in $$(ls -A /var); do test $$i = test-exec-temporaryfilesystem || false; done'
4cac89bd 13
ad8e66dc
AJ
14# Check default mode
15ExecStart=sh -x -c 'test "$$(stat -c %%a /var)" = "755"'
16
4cac89bd 17# Cannot create a file in /var
63403f07 18ExecStart=sh -c '! touch /var/hoge'
4cac89bd
YW
19
20# Create a file in /var/test-exec-temporaryfilesystem/rw
63403f07 21ExecStart=sh -c 'touch /var/test-exec-temporaryfilesystem/rw/thisisasimpletest-temporaryfilesystem'
4cac89bd
YW
22
23# Then, the file can be access through /tmp
63403f07 24ExecStart=sh -c 'test -f /tmp/thisisasimpletest-temporaryfilesystem'
4cac89bd
YW
25
26# Also, through /var/test-exec-temporaryfilesystem/ro
63403f07 27ExecStart=sh -c 'test -f /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem'
4cac89bd
YW
28
29# The file cannot modify through /var/test-exec-temporaryfilesystem/ro
63403f07 30ExecStart=sh -c '! touch /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem'
4cac89bd
YW
31
32# Cleanup
63403f07 33ExecStart=sh -c 'rm /tmp/thisisasimpletest-temporaryfilesystem'
4cac89bd
YW
34
35TemporaryFileSystem=/var:ro
36BindPaths=/tmp:/var/test-exec-temporaryfilesystem/rw
37BindReadOnlyPaths=/tmp:/var/test-exec-temporaryfilesystem/ro