Blame SOURCES/0006-luks-enable-debugging-in-clevis-scripts-when-rd.debu.patch

f67ea7
From af10e0fb8cb63d9c3a429b7efa293fe2fe0e2767 Mon Sep 17 00:00:00 2001
f67ea7
From: =?UTF-8?q?Renaud=20M=C3=A9trich?=
f67ea7
 <1163635+rmetrich@users.noreply.github.com>
f67ea7
Date: Wed, 1 Dec 2021 09:37:35 -0300
f67ea7
Subject: [PATCH 6/6] luks: enable debugging in clevis scripts when rd.debug is
f67ea7
 set (#340)
f67ea7
f67ea7
On Fedora/RHEL, the rd.debug kernel command line parameter controls
f67ea7
debugging.
f67ea7
By implementing the functionality inside clevis, troubleshooting will be
f67ea7
greatly eased.
f67ea7
See RHBZ #1980742 (https://bugzilla.redhat.com/show_bug.cgi?id=1980742).
f67ea7
---
f67ea7
 src/luks/clevis-luks-common-functions | 15 +++++++++++++++
f67ea7
 1 file changed, 15 insertions(+)
f67ea7
f67ea7
diff --git a/src/luks/clevis-luks-common-functions b/src/luks/clevis-luks-common-functions
f67ea7
index df8e16d..67ece72 100644
f67ea7
--- a/src/luks/clevis-luks-common-functions
f67ea7
+++ b/src/luks/clevis-luks-common-functions
f67ea7
@@ -20,6 +20,21 @@
f67ea7
 
f67ea7
 CLEVIS_UUID="cb6e8904-81ff-40da-a84a-07ab9ab5715e"
f67ea7
 
f67ea7
+enable_debugging() {
f67ea7
+    # Automatically enable debugging if in initramfs phase and rd.debug
f67ea7
+    if [ -e /usr/lib/dracut-lib.sh ]; then
f67ea7
+        local bashopts=$-
f67ea7
+        # Because dracut is loosely written, disable hardening options temporarily
f67ea7
+        [[ $bashopts != *u* ]] || set +u
f67ea7
+        [[ $bashopts != *e* ]] || set +e
f67ea7
+        . /usr/lib/dracut-lib.sh
f67ea7
+        [[ $bashopts != *u* ]] || set -u
f67ea7
+        [[ $bashopts != *e* ]] || set -e
f67ea7
+    fi
f67ea7
+}
f67ea7
+
f67ea7
+enable_debugging
f67ea7
+
f67ea7
 # valid_slot() will check whether a given slot is possibly valid, i.e., if it
f67ea7
 # is a numeric value within the specified range.
f67ea7
 valid_slot() {
f67ea7
-- 
f67ea7
2.33.1
f67ea7