From 822cf646182f8ff649ea08da2fd4365022871a61 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Sat, 7 Jan 2023 15:13:36 -0500 Subject: [PATCH] output --- .../cold-boot-attack-defense-kexec-prepare | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare b/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare index eda249b..fcf13f7 100755 --- a/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare +++ b/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare @@ -15,27 +15,28 @@ kernel=$(echo "$cmdline" | grep -o 'BOOT_IMAGE=\S*' | cut -d '=' -f 2) initrd=$(echo "$kernel" | sed "s#vmlinuz#initrd.img#") if ! test -r "$initrd"; then - echo "$0: ERROR: Initrd File '$initrd' not found or not readable!" - exit 1 + echo "$0: ERROR: Initrd File '$initrd' not found or not readable!" + exit 1 fi if ! test -r "$kernel"; then - echo "$0: ERROR: Kernel File '$kernel' not found or not readable!" - exit 1 + echo "$0: ERROR: Kernel File '$kernel' not found or not readable!" + exit 1 fi if systemctl list-jobs | grep "poweroff.target" | grep -q "start"; then - wiperamexit="yes" - wiperamaction="poweroff" + wiperamexit="yes" + wiperamaction="poweroff" elif systemctl list-jobs | grep "reboot.target" | grep -q "start"; then - wiperamexit="yes" - wiperamaction="reboot" + wiperamexit="yes" + wiperamaction="reboot" elif systemctl list-jobs | grep "halt.target" | grep -q "start"; then - wiperamexit="yes" - wiperamaction="halt" + wiperamexit="yes" + wiperamaction="halt" else - echo "$0: INFO: No shutdown option found!" - exit 0 + ## Could be kexec.target. + echo "$0: INFO: Neither poweroff, reboot or halt. Therefore skipping kexec load, ok." + exit 0 fi kexec -l "$kernel" --initrd="$initrd" --reuse-cmdline --append="wiperamexit=$wiperamexit wiperamaction=$wiperamaction"