]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-26-SETENV/testsuite.sh
2d93cb49c981b2407cebc759a2b4bb807ffbba0e
[thirdparty/systemd.git] / test / TEST-26-SETENV / testsuite.sh
1 #!/bin/bash
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4 set -ex
5 set -o pipefail
6
7 # Make sure PATH is set
8 systemctl show-environment | grep -q '^PATH='
9
10 # Let's add an entry and override a built-in one
11 systemctl set-environment PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/testaddition FOO=BAR
12
13 # Check that both are set
14 systemctl show-environment | grep -q '^PATH=.*testaddition$'
15 systemctl show-environment | grep -q '^FOO=BAR$'
16
17 systemctl daemon-reload
18
19 # Check again after the reload
20 systemctl show-environment | grep -q '^PATH=.*testaddition$'
21 systemctl show-environment | grep -q '^FOO=BAR$'
22
23 # Drop both
24 systemctl unset-environment FOO PATH
25
26 # Check that one is gone and the other reverted to the built-in
27 ! (systemctl show-environment | grep -q '^FOO=$')
28 ! (systemctl show-environment | grep -q '^PATH=.*testaddition$')
29 systemctl show-environment | grep -q '^PATH='
30
31 echo OK > /testok
32
33 exit 0