]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/test-execute/exec-temporaryfilesystem-rw.service
tests: add spdx license header to test unit/link/network/conf files
[thirdparty/systemd.git] / test / test-execute / exec-temporaryfilesystem-rw.service
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2 [Unit]
3 Description=Test for TemporaryFileSystem
4
5 [Service]
6 Type=oneshot
7
8 # Check directories exist
9 ExecStart=test -d /var/test-exec-temporaryfilesystem/rw -a -d /var/test-exec-temporaryfilesystem/ro
10
11 # Check TemporaryFileSystem= are empty
12 ExecStart=sh -c 'for i in $$(ls -A /var); do test $$i = test-exec-temporaryfilesystem || false; done'
13
14 # Check default mode
15 ExecStart=sh -x -c 'test "$$(stat -c %%a /var)" = "755"'
16
17 # Create a file in /var
18 ExecStart=touch /var/hoge
19
20 # Create a file in /var/test-exec-temporaryfilesystem/rw
21 ExecStart=touch /var/test-exec-temporaryfilesystem/rw/thisisasimpletest-temporaryfilesystem
22
23 # Then, the file can be access through /tmp
24 ExecStart=test -f /tmp/thisisasimpletest-temporaryfilesystem
25
26 # Also, through /var/test-exec-temporaryfilesystem/ro
27 ExecStart=test -f /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem
28
29 # The file cannot modify through /var/test-exec-temporaryfilesystem/ro
30 ExecStart=sh -c '! touch /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem'
31
32 # Cleanup
33 ExecStart=rm /tmp/thisisasimpletest-temporaryfilesystem
34
35 TemporaryFileSystem=/var
36 BindPaths=/tmp:/var/test-exec-temporaryfilesystem/rw
37 BindReadOnlyPaths=/tmp:/var/test-exec-temporaryfilesystem/ro