From 2f88bb9aee0d29afacd7f768bec8d867da2cd799 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 7 Mar 2023 15:24:13 +0100 Subject: mkosi: Fix locations of mkosi-check-and-shutdown files --- .../etc/systemd/system/mkosi-check-and-shutdown.service | 14 -------------- .../etc/systemd/system/mkosi-check-and-shutdown.sh | 15 --------------- mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh | 15 +++++++++++++++ .../lib/systemd/system/mkosi-check-and-shutdown.service | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 29 deletions(-) delete mode 100644 mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.service delete mode 100755 mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.sh create mode 100755 mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh create mode 100644 mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service diff --git a/mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.service b/mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.service deleted file mode 100644 index 6539325108..0000000000 --- a/mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.service +++ /dev/null @@ -1,14 +0,0 @@ -# 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/mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.sh b/mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.sh deleted file mode 100755 index b86d2d3e69..0000000000 --- a/mkosi.extra/etc/systemd/system/mkosi-check-and-shutdown.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -eux -# SPDX-License-Identifier: LGPL-2.1-or-later - -systemctl --failed --no-legend | tee /failed-services - -# Check that secure boot keys were properly enrolled. -if [[ -d /sys/firmware/efi/efivars/ ]]; then - cmp /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c <(printf '\6\0\0\0\1') - cmp /sys/firmware/efi/efivars/SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c <(printf '\6\0\0\0\0') -fi - -# Exit with non-zero EC if the /failed-services file is not empty (we have -e set) -[[ ! -s /failed-services ]] - -: >/testok diff --git a/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh b/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh new file mode 100755 index 0000000000..b86d2d3e69 --- /dev/null +++ b/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh @@ -0,0 +1,15 @@ +#!/bin/bash -eux +# SPDX-License-Identifier: LGPL-2.1-or-later + +systemctl --failed --no-legend | tee /failed-services + +# Check that secure boot keys were properly enrolled. +if [[ -d /sys/firmware/efi/efivars/ ]]; then + cmp /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c <(printf '\6\0\0\0\1') + cmp /sys/firmware/efi/efivars/SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c <(printf '\6\0\0\0\0') +fi + +# Exit with non-zero EC if the /failed-services file is not empty (we have -e set) +[[ ! -s /failed-services ]] + +: >/testok diff --git a/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service b/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service new file mode 100644 index 0000000000..6539325108 --- /dev/null +++ b/mkosi.extra/usr/lib/systemd/system/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 -- cgit v1.2.3