test: move TEST-18-FAILUREACTION setup to static files

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-03-28 11:46:47 +01:00
parent 9911131a60
commit dce2b8ce48
3 changed files with 7 additions and 14 deletions
+6
View File
@@ -0,0 +1,6 @@
[Unit]
Description=TEST-18-FAILUREACTION
[Service]
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -ex
set -o pipefail
systemd-run --wait -p FailureAction=poweroff true
! systemd-run --wait -p SuccessAction=poweroff false
if ! test -f /firstphase ; then
echo OK > /firstphase
systemd-run --wait -p SuccessAction=reboot true
else
echo OK > /testok
systemd-run --wait -p FailureAction=poweroff false
fi
sleep infinity