TMP_CONFIG="/tmp/grub_config_efi"
+# this allows us to find this specific Grml ISO,
+# even if there are multiple Grml ISOs present
+bootfile="${GRML_NAME}_$(TZ=UTC date +%s)"
+echo "$bootfile" > "${target}/"boot/grub/bootfile.txt
+
cat > "${target}/${TMP_CONFIG}" <<EOF
-search.file /conf/bootid.txt root
+search.file /conf/bootfile_$bootfile root
set prefix=(\$root)/boot/grub
insmod normal
normal
-echo "E: Could not find root device!"
+echo "E: Could not find root device (for /conf/bootfile_$bootfile)!"
EOF
ARCHS=(i386-pc)
eend $?
fi
+ # every recent Grml ISO ships a /conf/bootid.txt, though GRUB might find
+ # the /conf/bootid.txt of a different (Grml) ISO than the one that's
+ # supposed to be running, so within scripts/GRMLBASE/45-grub-images
+ # we generate a random filename, stored inside /boot/grub/bootfile.txt,
+ # which we place on the resulting ISO here
+ if [ -r "${CHROOT_OUTPUT}"/boot/grub/bootfile.txt ] ; then
+ mkdir -p "${BUILD_OUTPUT}"/conf
+ rm -f "${BUILD_OUTPUT}"/conf/bootfile* # ensure we don't leave any old(er) files behind
+
+ einfo "Generating "${BUILD_OUTPUT}"/conf/bootfile* files"
+ log "Generating "${BUILD_OUTPUT}"/conf/bootfile* files"
+
+ # 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)"
+ eend $?
+ fi
+
grub_setup
# EFI boot files