ci: check for failed services after boot
This should, hopefully, catch issues like systemd/systemd#21671 automagically.
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user