1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-25 10:04:04 +03:00

35 lines
921 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
TEST_DESCRIPTION="shutdown testing"
IMAGE_NAME="shutdown"
TEST_NO_QEMU=1
# shellcheck source=test/test-functions
. "${TEST_BASE_DIR:?}/test-functions"
2022-01-31 16:48:15 +01:00
_ORIG_NSPAWN="${SYSTEMD_NSPAWN:?}"
SYSTEMD_NSPAWN="${STATEDIR:?}/run-nspawn"
setup_nspawn_root_hook() {
2022-01-31 16:48:15 +01:00
cat > "${STATEDIR:?}"/run-nspawn <<-EOF
#!/bin/bash
2022-01-31 16:48:15 +01:00
exec "${TEST_BASE_DIR:?}"/test-shutdown.py -- "$_ORIG_NSPAWN" "\$@"
exit 1
EOF
2022-01-31 16:48:15 +01:00
chmod 755 "${STATEDIR:?}"/run-nspawn
}
test_append_files() {
2022-01-31 16:48:15 +01:00
local workspace="${1:?}"
# prevent shutdown in test suite, the expect script does that manually.
2022-01-31 16:48:15 +01:00
rm "${workspace:?}/usr/lib/systemd/tests/testdata/units/end.service"
inst /usr/bin/screen
2022-01-31 16:48:15 +01:00
echo "PS1='screen\$WINDOW # '" >"$workspace/etc/bash.bashrc"
echo 'startup_message off' >"$workspace/etc/screenrc"
echo 'bell_msg ""' >>"$1/etc/screenrc"
}
do_test "$@"