]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-42-EXECSTOPPOST/test.sh
treewide: more portable bash shebangs
[thirdparty/systemd.git] / test / TEST-42-EXECSTOPPOST / test.sh
1 #!/usr/bin/env bash
2 set -e
3 TEST_DESCRIPTION="test that ExecStopPost= is always run"
4
5 . $TEST_BASE_DIR/test-functions
6
7 test_setup() {
8 create_empty_image_rootdir
9
10 (
11 LOG_LEVEL=5
12 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
13
14 setup_basic_environment
15
16 mask_supporting_services
17
18 # setup policy for Type=dbus test
19 mkdir -p $initdir/etc/dbus-1/system.d
20 cat > $initdir/etc/dbus-1/system.d/systemd.test.ExecStopPost.conf <<EOF
21 <?xml version="1.0"?>
22 <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
23 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
24 <busconfig>
25 <policy user="root">
26 <allow own="systemd.test.ExecStopPost"/>
27 </policy>
28 </busconfig>
29 EOF
30
31 # setup the testsuite service
32 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
33 [Unit]
34 Description=Testsuite service
35 Before=getty-pre.target
36 Wants=getty-pre.target
37
38 [Service]
39 ExecStart=/testsuite.sh
40 Type=oneshot
41 EOF
42 cp testsuite.sh $initdir/
43
44 setup_testsuite
45 )
46 setup_nspawn_root
47 }
48
49 do_test "$@"