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

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