diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-12-10 13:50:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 13:50:55 +0000 |
commit | f4ec527492d36f3cde3c1b86fae3eadd2f2df833 (patch) | |
tree | 2a2055861c77514070a24a0755fc25fbcef6e7ad /test | |
parent | ea5e55b3112205194cfb6302710e989158d95b1d (diff) | |
parent | f7e3951d41d27d2f627acc55f80d6956e4d61d9a (diff) | |
download | systemd-f4ec527492d36f3cde3c1b86fae3eadd2f2df833.tar.gz |
Merge pull request #21708 from mrc0mmand/mkosi-ci-improvements
ci: check for failed services after boot
Diffstat (limited to 'test')
-rw-r--r-- | test/mkosi-check-and-shutdown.service | 14 | ||||
-rw-r--r-- | test/mkosi-check-and-shutdown.sh | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/mkosi-check-and-shutdown.service b/test/mkosi-check-and-shutdown.service new file mode 100644 index 0000000000..6539325108 --- /dev/null +++ b/test/mkosi-check-and-shutdown.service @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Check if any service failed and then shutdown the machine +After=multi-user.target network-online.target +Requires=multi-user.target +Wants=systemd-resolved.service systemd-networkd.service network-online.target +OnFailure=poweroff.target +OnFailureJobMode=replace-irreversibly + +[Service] +Type=oneshot +ExecStartPre=-rm -f /failed-services +ExecStart=/usr/lib/systemd/mkosi-check-and-shutdown.sh +ExecStartPost=systemctl poweroff --no-block diff --git a/test/mkosi-check-and-shutdown.sh b/test/mkosi-check-and-shutdown.sh new file mode 100644 index 0000000000..ed76ef370a --- /dev/null +++ b/test/mkosi-check-and-shutdown.sh @@ -0,0 +1,9 @@ +#!/bin/bash -eux +# SPDX-License-Identifier: LGPL-2.1-or-later + +systemctl --failed --no-legend | tee /failed-services + +# Exit with non-zero EC if the /failed-services file is not empty (we have -e set) +[[ ! -s /failed-services ]] + +: >/testok |