summaryrefslogtreecommitdiff
path: root/test/test-execute/exec-dynamicuser-state-dir.service
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-execute/exec-dynamicuser-state-dir.service')
-rw-r--r--test/test-execute/exec-dynamicuser-state-dir.service19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test-execute/exec-dynamicuser-state-dir.service b/test/test-execute/exec-dynamicuser-state-dir.service
new file mode 100644
index 0000000000..7e2d88450b
--- /dev/null
+++ b/test/test-execute/exec-dynamicuser-state-dir.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Test DynamicUser= with StateDirectory=
+
+[Service]
+ExecStart=/usr/bin/test -w /var/lib/waldo
+ExecStart=/usr/bin/test -w /var/lib/quux/pief
+ExecStart=/bin/touch /var/lib/waldo/yay
+ExecStart=/bin/touch /var/lib/quux/pief/yayyay
+ExecStart=/usr/bin/test -f /var/lib/waldo/yay
+ExecStart=/usr/bin/test -f /var/lib/quux/pief/yayyay
+ExecStart=/usr/bin/test -f /var/lib/private/waldo/yay
+ExecStart=/usr/bin/test -f /var/lib/private/quux/pief/yayyay
+
+# Make sure that /var/lib/private/waldo is really the only writable directory besides the obvious candidates
+ExecStart=/bin/sh -x -c 'test $$(find / -type d -writable 2> /dev/null | egrep -v -e \'^(/var/tmp$$|/tmp$$|/proc/|/dev/mqueue$$|/dev/shm$$)\' | sort -u | tr -d '\\\\n') = /var/lib/private/quux/pief/var/lib/private/waldo'
+
+Type=oneshot
+DynamicUser=yes
+StateDirectory=waldo quux/pief