mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
a6dac790c8
To avoid unexpected surprised in CIs with different default shell.
40 lines
1.4 KiB
Bash
Executable File
40 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
# shellcheck disable=SC2016
|
|
set -eux
|
|
set -o pipefail
|
|
|
|
# Test adding new BindPaths while unit is already running
|
|
|
|
at_exit() {
|
|
set +e
|
|
|
|
rm -f /run/testsuite-23-marker-{fixed,runtime}
|
|
rm -fr /run/inaccessible
|
|
}
|
|
|
|
trap at_exit EXIT
|
|
|
|
echo "MARKER_FIXED" >/run/testsuite-23-marker-fixed
|
|
mkdir /run/inaccessible
|
|
|
|
systemctl start testsuite-23-namespaced.service
|
|
|
|
# Ensure that inaccessible paths aren't bypassed by the runtime setup,
|
|
(! systemctl bind --mkdir testsuite-23-namespaced.service /run/testsuite-23-marker-fixed /run/inaccessible/testfile-marker-fixed)
|
|
|
|
echo "MARKER_RUNTIME" >/run/testsuite-23-marker-runtime
|
|
|
|
systemctl bind --mkdir testsuite-23-namespaced.service /run/testsuite-23-marker-runtime /tmp/testfile-marker-runtime
|
|
|
|
timeout 10 bash -xec 'while [[ "$(systemctl show -P SubState testsuite-23-namespaced.service)" == running ]]; do sleep .5; done'
|
|
systemctl is-active testsuite-23-namespaced.service
|
|
|
|
# Now test that systemctl bind fails when attempted on a non-namespaced unit
|
|
systemctl start testsuite-23-non-namespaced.service
|
|
|
|
(! systemctl bind --mkdir testsuite-49-non-namespaced.service /run/testsuite-23-marker-runtime /tmp/testfile-marker-runtime)
|
|
|
|
timeout 10 bash -xec 'while [[ "$(systemctl show -P SubState testsuite-23-non-namespaced.service)" == running ]]; do sleep .5; done'
|
|
(! systemctl is-active testsuite-23-non-namespaced.service)
|