]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/units/testsuite-23.runtime-bind-paths.sh
test: get rid of the busybox stuff
[thirdparty/systemd.git] / test / units / testsuite-23.runtime-bind-paths.sh
CommitLineData
518c3e27
FS
1#!/usr/bin/env bash
2# SPDX-License-Identifier: LGPL-2.1-or-later
3# shellcheck disable=SC2016
4set -eux
5set -o pipefail
6
7# Test adding new BindPaths while unit is already running
8
9at_exit() {
10 set +e
11
12 rm -f /run/testsuite-23-marker-{fixed,runtime}
13 rm -fr /run/inaccessible
14}
15
16trap at_exit EXIT
17
18echo "MARKER_FIXED" >/run/testsuite-23-marker-fixed
19mkdir /run/inaccessible
20
21systemctl start testsuite-23-namespaced.service
22
23# Ensure that inaccessible paths aren't bypassed by the runtime setup,
24(! systemctl bind --mkdir testsuite-23-namespaced.service /run/testsuite-23-marker-fixed /run/inaccessible/testfile-marker-fixed)
25
26echo "MARKER_RUNTIME" >/run/testsuite-23-marker-runtime
27
28systemctl bind --mkdir testsuite-23-namespaced.service /run/testsuite-23-marker-runtime /tmp/testfile-marker-runtime
29
30timeout 10 sh -xec 'while [[ "$(systemctl show -P SubState testsuite-23-namespaced.service)" == running ]]; do sleep .5; done'
31systemctl is-active testsuite-23-namespaced.service
32
33# Now test that systemctl bind fails when attempted on a non-namespaced unit
34systemctl start testsuite-23-non-namespaced.service
35
36(! systemctl bind --mkdir testsuite-49-non-namespaced.service /run/testsuite-23-marker-runtime /tmp/testfile-marker-runtime)
37
38timeout 10 sh -xec 'while [[ "$(systemctl show -P SubState testsuite-23-non-namespaced.service)" == running ]]; do sleep .5; done'
39(! systemctl is-active testsuite-23-non-namespaced.service)