]>
Commit | Line | Data |
---|---|---|
79411bbc | 1 | #!/bin/bash |
79411bbc LP |
2 | set -ex |
3 | set -o pipefail | |
4 | ||
5 | # Make sure PATH is set | |
6 | systemctl show-environment | grep -q '^PATH=' | |
7 | ||
8 | # Let's add an entry and override a built-in one | |
9 | systemctl set-environment PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/testaddition FOO=BAR | |
10 | ||
11 | # Check that both are set | |
12 | systemctl show-environment | grep -q '^PATH=.*testaddition$' | |
13 | systemctl show-environment | grep -q '^FOO=BAR$' | |
14 | ||
15 | systemctl daemon-reload | |
16 | ||
17 | # Check again after the reload | |
18 | systemctl show-environment | grep -q '^PATH=.*testaddition$' | |
19 | systemctl show-environment | grep -q '^FOO=BAR$' | |
20 | ||
21 | # Drop both | |
22 | systemctl unset-environment FOO PATH | |
23 | ||
24 | # Check that one is gone and the other reverted to the built-in | |
25 | ! (systemctl show-environment | grep -q '^FOO=$') | |
26 | ! (systemctl show-environment | grep -q '^PATH=.*testaddition$') | |
27 | systemctl show-environment | grep -q '^PATH=' | |
28 | ||
29 | echo OK > /testok | |
30 | ||
31 | exit 0 |