]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
01fips: trim off GRUB boot device from BOOT_IMAGE
authorJonathan Lebon <jonathan@jlebon.com>
Tue, 29 Oct 2019 20:54:10 +0000 (16:54 -0400)
committerLukáš Nykrýn <lnykryn@redhat.com>
Thu, 31 Oct 2019 10:12:36 +0000 (11:12 +0100)
E.g. in RHCOS, the `BOOT_IMAGE` from the cmdline is:

(hd0,gpt1)/ostree/rhcos-e493371e5ee8407889029ec979955a2b86fd7e3cae5a0591b9db1cd248d966e8/vmlinuz-4.18.0-146.el8.x86_64

Which of course is a GRUB thing, not an actual pathname we'll be able to
resolve. In fact, we can simply scrap it off from the variable. Our code
is already able to handle both cases: whether the device refers to a
separate boot partition, or just the root filesystem with a regular
`/boot` directory.

modules.d/01fips/fips.sh

index 4b3b70809681e905661ca232922162f3a7c9884f..031ada8b0556356ee77ce2a090b672def4077059 100755 (executable)
@@ -113,6 +113,10 @@ do_fips()
         do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
     else
         BOOT_IMAGE="$(getarg BOOT_IMAGE)"
+
+        # Trim off any leading GRUB boot device (e.g. ($root) )
+        BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
+
         BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
         BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"