]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: add drop-in to make emergency.service shut down the system
authorLuca Boccassi <bluca@debian.org>
Wed, 26 Jul 2023 11:36:40 +0000 (12:36 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 26 Jul 2023 13:07:13 +0000 (14:07 +0100)
When the mkosi CI fails to boot, it just sits there waiting at the emergency
console until the job times out. Add a drop-in for emergency.service in the
CI configuration so that instead it exists immediately.

.github/workflows/mkosi.yml

index 2a0f7a90965119a1c8d5e3810929fc27e9e8ac7d..2ab8423a60e24c6be75eff5357e2de306b3d74d8 100644 (file)
@@ -112,6 +112,20 @@ jobs:
         Format=squashfs
         EOF
 
+        # The emergency shell is not useful in the CI, as it just blocks for a long time before the job
+        # eventually times out. Override it to just shutdown immediately.
+        mkdir -p mkosi.presets/10-initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
+        mkdir -p mkosi.presets/20-final/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
+        tee mkosi.presets/10-initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf <<- EOF
+        [Unit]
+        FailureAction=exit
+        [Service]
+        ExecStartPre=
+        ExecStart=
+        ExecStart=false
+        EOF
+        cp mkosi.presets/10-initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf mkosi.presets/20-final/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf
+
     - name: Generate secure boot key
       run: mkosi --debug genkey