2021-10-17 19:07:22 +03:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2018-02-20 10:50:12 +03:00
[Unit]
Description = Test for TemporaryFileSystem
[Service]
Type = oneshot
# Check directories exist
2018-03-25 22:10:50 +03:00
ExecStart = test -d /var/test-exec-temporaryfilesystem/rw -a -d /var/test-exec-temporaryfilesystem/ro
2018-02-20 10:50:12 +03:00
# Check TemporaryFileSystem= are empty
2018-03-25 22:10:50 +03:00
ExecStart = sh -c 'for i in $$(ls -A /var); do test $$i = test-exec-temporaryfilesystem || false; done'
2018-02-20 10:50:12 +03:00
2018-08-30 00:36:37 +03:00
# Check default mode
ExecStart = sh -x -c 'test "$$(stat -c %%a /var)" = "755"'
2018-02-20 10:50:12 +03:00
# Create a file in /var
2018-03-25 22:10:50 +03:00
ExecStart = touch /var/hoge
2018-02-20 10:50:12 +03:00
# Create a file in /var/test-exec-temporaryfilesystem/rw
2018-03-25 22:10:50 +03:00
ExecStart = touch /var/test-exec-temporaryfilesystem/rw/thisisasimpletest-temporaryfilesystem
2018-02-20 10:50:12 +03:00
# Then, the file can be access through /tmp
2018-03-25 22:10:50 +03:00
ExecStart = test -f /tmp/thisisasimpletest-temporaryfilesystem
2018-02-20 10:50:12 +03:00
# Also, through /var/test-exec-temporaryfilesystem/ro
2018-03-25 22:10:50 +03:00
ExecStart = test -f /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem
2018-02-20 10:50:12 +03:00
# The file cannot modify through /var/test-exec-temporaryfilesystem/ro
2018-03-25 22:10:50 +03:00
ExecStart = sh -c '! touch /var/test-exec-temporaryfilesystem/ro/thisisasimpletest-temporaryfilesystem'
2018-02-20 10:50:12 +03:00
# Cleanup
2018-03-25 22:10:50 +03:00
ExecStart = rm /tmp/thisisasimpletest-temporaryfilesystem
2018-02-20 10:50:12 +03:00
TemporaryFileSystem = /var
BindPaths = /tmp:/var/test-exec-temporaryfilesystem/rw
BindReadOnlyPaths = /tmp:/var/test-exec-temporaryfilesystem/ro