]> git.proxmox.com Git - systemd.git/blob - test/test-execute/exec-temporaryfilesystem-ro.service
New upstream version 240
[systemd.git] / test / test-execute / exec-temporaryfilesystem-ro.service
1 [Unit]
2 Description=Test for TemporaryFileSystem with read-only mode
3
4 [Service]
5 Type=oneshot
6
7 # Check directories exist
8 ExecStart=/bin/sh -c 'test -d /var/test-exec-temporaryfilesystem/rw && test -d /var/test-exec-temporaryfilesystem/ro'
9
10 # Check TemporaryFileSystem= are empty
11 ExecStart=/bin/sh -c 'for i in $$(ls -A /var); do test $$i = test-exec-temporaryfilesystem || false; done'
12
13 # Check default mode
14 ExecStart=sh -x -c 'test "$$(stat -c %%a /var)" = "755"'
15
16 # Cannot create a file in /var
17 ExecStart=/bin/sh -c '! touch /var/hoge'
18
19 # Create a file in /var/test-exec-temporaryfilesystem/rw
20 ExecStart=/bin/sh -c 'touch /var/test-exec-temporaryfilesystem/rw/thisisasimpletest-temporaryfilesystem'
21
22 # Then, the file can be access through /tmp
23 ExecStart=/bin/sh -c 'test -f /tmp/thisisasimpletest-temporaryfilesystem'
24
25 # Also, through /var/test-exec-temporaryfilesystem/ro
26 ExecStart=/bin/sh -c 'test -f /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem'
27
28 # The file cannot modify through /var/test-exec-temporaryfilesystem/ro
29 ExecStart=/bin/sh -c '! touch /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem'
30
31 # Cleanup
32 ExecStart=/bin/sh -c 'rm /tmp/thisisasimpletest-temporaryfilesystem'
33
34 TemporaryFileSystem=/var:ro
35 BindPaths=/tmp:/var/test-exec-temporaryfilesystem/rw
36 BindReadOnlyPaths=/tmp:/var/test-exec-temporaryfilesystem/ro