summaryrefslogtreecommitdiffstats
path: root/mkosi.images/exitrd/mkosi.extra/shutdown
diff options
context:
space:
mode:
Diffstat (limited to 'mkosi.images/exitrd/mkosi.extra/shutdown')
-rwxr-xr-xmkosi.images/exitrd/mkosi.extra/shutdown12
1 files changed, 12 insertions, 0 deletions
diff --git a/mkosi.images/exitrd/mkosi.extra/shutdown b/mkosi.images/exitrd/mkosi.extra/shutdown
new file mode 100755
index 0000000..e4c6087
--- /dev/null
+++ b/mkosi.images/exitrd/mkosi.extra/shutdown
@@ -0,0 +1,12 @@
+#!/usr/bin/bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+
+EXIT_CODE=()
+
+# Translate a successful exit code to 124 so that we can detect that the exitrd was actually used.
+if [[ "$*" == *"--exit-code=123"* ]]; then
+ EXIT_CODE+=("--exit-code=124")
+fi
+
+exec /usr/lib/systemd/systemd-shutdown "$@" "${EXIT_CODE[@]}"