1# SPDX-License-Identifier: LGPL-2.1-or-later
2[Unit]
3Description=Test DynamicUser= with StateDirectory=
4
5[Service]
6ExecStart=test -w /var/lib/waldo
7ExecStart=test -w /var/lib/quux/pief
8ExecStart=touch /var/lib/waldo/yay
9ExecStart=touch /var/lib/quux/pief/yayyay
10ExecStart=test -f /var/lib/waldo/yay
11ExecStart=test -f /var/lib/quux/pief/yayyay
12ExecStart=test -f /var/lib/private/waldo/yay
13ExecStart=test -f /var/lib/private/quux/pief/yayyay
14ExecStart=sh -x -c 'test "$$STATE_DIRECTORY" = "%S/waldo:%S/quux/pief"'
15
16# Make sure that /var/lib/private/waldo is really the only writable directory besides the obvious candidates
17ExecStart=sh -x -c 'test $$(find / \\( -path /var/tmp -o -path /tmp -o -path /proc -o -path /dev/mqueue -o -path /dev/shm -o -path /sys/fs/bpf -o -path /dev/.lxc -o -path /sys/devices/system/cpu \\) -prune -o -type d -writable -print 2>/dev/null | sort -u | tr -d "\\\\n") = /var/lib/private/quux/pief/var/lib/private/waldo'
18
19Type=oneshot
20DynamicUser=yes
21StateDirectory=waldo quux/pief
22