Support BOOT_FILE variable for usage within secureboot templates
authorMichael Prokop <mika@grml.org>
Fri, 23 Nov 2018 07:26:00 +0000 (08:26 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 23 Nov 2018 07:31:30 +0000 (08:31 +0100)
This is related to:

| commit 642e1b389347bcb8d6e44b483c327e45225427f4
| Author: Michael Prokop <mika@grml.org>
| Date:   Thu Nov 22 23:54:10 2018 +0100
|
|     Ensure GRUB finds the running ISO

By using the same approach for setting $root within GRUB
also for the Secure Boot GRUB configuration we ensure to
apply the same safety measures to Secure Boot mode.

grml-live
templates/secureboot/grub.cfg

index 6043764..c1a37d9 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -330,6 +330,9 @@ adjust_boot_files() {
       sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/g"    "${file}"
       sed -i "s/%SHORT_NAME%/$SHORT_NAME/g"        "${file}"
       sed -i "s/%VERSION%/$VERSION/g"              "${file}"
+      if [ -n "${BOOT_FILE}" ] ; then
+        sed -i "s;%BOOT_FILE%;$BOOT_FILE;g"        "${file}"
+      fi
 
       [ -n "$DEFAULT_BOOTOPTIONS" ] && sed -i "s; boot=live; boot=live $DEFAULT_BOOTOPTIONS;"  "${file}"
 
@@ -1023,11 +1026,10 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
       einfo "Generating "${BUILD_OUTPUT}"/conf/bootfile* files"
       log   "Generating "${BUILD_OUTPUT}"/conf/bootfile* files"
 
+      BOOT_FILE="/conf/bootfile_$(cat "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt)"
+      echo "# This file is relevant for GRUB boot with the Grml ISO." > "${BUILD_OUTPUT}/${BOOT_FILE}"
       # save information about the random filename inside /conf/bootfile.txt
-      echo "/conf/bootfile_$(cat "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt)" > \
-        "${BUILD_OUTPUT}"/conf/bootfile.txt
-      echo "# This file is relevant for GRUB boot with the Grml ISO." > \
-        "${BUILD_OUTPUT}"/conf/bootfile_"$(cat "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt)"
+      echo "${BOOT_FILE}" > "${BUILD_OUTPUT}"/conf/bootfile.txt
       eend $?
     fi
 
index a56033d..f98e37e 100644 (file)
@@ -3,7 +3,7 @@ export grml_orig_prefix
 set grml_orig_root=$root
 export grml_orig_root
 
-search.file /boot/grub/grmlenv.cfg root
+search.file %BOOT_FILE% root
 set prefix=($root)/boot/grub/
 source ($root)/boot/grub/grmlenv.cfg