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