]>
Commit | Line | Data |
---|---|---|
ff12a795 | 1 | #!/usr/bin/env bash |
7b3cec95 | 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
084575ff | 3 | set -eux |
528c3656 LP |
4 | set -o pipefail |
5 | ||
6 | systemd-analyze log-level debug | |
7 | systemd-analyze log-target console | |
8 | ||
9 | # Set everything up without DynamicUser=1 | |
10 | ||
11 | systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz touch /var/lib/zzz/test | |
12 | systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test | |
4e20fe27 ZJS |
13 | systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \ |
14 | && { echo 'unexpected success'; exit 1; } | |
528c3656 LP |
15 | |
16 | test -d /var/lib/zzz | |
ffa328f0 ZJS |
17 | test ! -L /var/lib/zzz |
18 | test ! -e /var/lib/private/zzz | |
528c3656 | 19 | test -f /var/lib/zzz/test |
ffa328f0 | 20 | test ! -f /var/lib/zzz/test-missing |
528c3656 LP |
21 | |
22 | # Convert to DynamicUser=1 | |
23 | ||
24 | systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test | |
4e20fe27 ZJS |
25 | systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \ |
26 | && { echo 'unexpected success'; exit 1; } | |
528c3656 LP |
27 | |
28 | test -L /var/lib/zzz | |
29 | test -d /var/lib/private/zzz | |
30 | ||
31 | test -f /var/lib/zzz/test | |
ffa328f0 | 32 | test ! -f /var/lib/zzz/test-missing |
528c3656 LP |
33 | |
34 | # Convert back | |
35 | ||
36 | systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test | |
4e20fe27 ZJS |
37 | systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \ |
38 | && { echo 'unexpected success'; exit 1; } | |
528c3656 LP |
39 | |
40 | test -d /var/lib/zzz | |
ffa328f0 ZJS |
41 | test ! -L /var/lib/zzz |
42 | test ! -e /var/lib/private/zzz | |
528c3656 | 43 | test -f /var/lib/zzz/test |
ffa328f0 | 44 | test ! -f /var/lib/zzz/test-missing |
528c3656 LP |
45 | |
46 | systemd-analyze log-level info | |
47 | ||
0ee99483 | 48 | echo OK >/testok |
528c3656 LP |
49 | |
50 | exit 0 |