]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/units/testsuite-26.sh
tests: add spdx headers to scripts and Makefiles
[thirdparty/systemd.git] / test / units / testsuite-26.sh
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -eux
4 set -o pipefail
5
6 # Make sure PATH is set
7 systemctl show-environment | grep -q '^PATH='
8
9 # Let's add an entry and override a built-in one
10 systemctl set-environment PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/testaddition FOO=BAR
11
12 # Check that both are set
13 systemctl show-environment | grep -q '^PATH=.*testaddition$'
14 systemctl show-environment | grep -q '^FOO=BAR$'
15
16 systemctl daemon-reload
17
18 # Check again after the reload
19 systemctl show-environment | grep -q '^PATH=.*testaddition$'
20 systemctl show-environment | grep -q '^FOO=BAR$'
21
22 # Drop both
23 systemctl unset-environment FOO PATH
24
25 # Check that one is gone and the other reverted to the built-in
26 systemctl show-environment | grep '^FOO=$' && exit 1
27 systemctl show-environment | grep '^PATH=.*testaddition$' && exit 1
28 systemctl show-environment | grep -q '^PATH='
29
30 echo OK >/testok
31
32 exit 0