Debian Codegraph @

test/testdata/test-execute/exec-temporaryfilesystem-ro.service

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