|
|
e83cdd |
From 9e8f172dc01f7e013bb5d302ef6c90e2dc6b30c8 Mon Sep 17 00:00:00 2001
|
|
|
e83cdd |
From: Jonathan Lebon <jonathan@jlebon.com>
|
|
|
e83cdd |
Date: Tue, 29 Oct 2019 16:54:10 -0400
|
|
|
e83cdd |
Subject: [PATCH] 01fips: trim off GRUB boot device from BOOT_IMAGE
|
|
|
e83cdd |
|
|
|
e83cdd |
E.g. in RHCOS, the `BOOT_IMAGE` from the cmdline is:
|
|
|
e83cdd |
|
|
|
e83cdd |
(hd0,gpt1)/ostree/rhcos-e493371e5ee8407889029ec979955a2b86fd7e3cae5a0591b9db1cd248d966e8/vmlinuz-4.18.0-146.el8.x86_64
|
|
|
e83cdd |
|
|
|
e83cdd |
Which of course is a GRUB thing, not an actual pathname we'll be able to
|
|
|
e83cdd |
resolve. In fact, we can simply scrap it off from the variable. Our code
|
|
|
e83cdd |
is already able to handle both cases: whether the device refers to a
|
|
|
e83cdd |
separate boot partition, or just the root filesystem with a regular
|
|
|
e83cdd |
`/boot` directory.
|
|
|
e83cdd |
---
|
|
|
e83cdd |
modules.d/01fips/fips.sh | 4 ++++
|
|
|
e83cdd |
1 file changed, 4 insertions(+)
|
|
|
e83cdd |
|
|
|
e83cdd |
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
|
|
|
e83cdd |
index de2755b0..559952ca 100755
|
|
|
e83cdd |
--- a/modules.d/01fips/fips.sh
|
|
|
e83cdd |
+++ b/modules.d/01fips/fips.sh
|
|
|
e83cdd |
@@ -113,6 +113,10 @@ do_fips()
|
|
|
e83cdd |
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
|
|
|
e83cdd |
else
|
|
|
e83cdd |
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
|
|
|
e83cdd |
+
|
|
|
e83cdd |
+ # Trim off any leading GRUB boot device (e.g. ($root) )
|
|
|
e83cdd |
+ BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
|
|
|
e83cdd |
+
|
|
|
e83cdd |
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
|
|
|
e83cdd |
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
|
|
|
e83cdd |
|
|
|
e83cdd |
|