From efa5742b296cc59fc8e18fed809df8ff3233a858 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Fri, 7 Apr 2023 19:26:39 +0200 Subject: [PATCH] Multiple locations for ISOs --- boot/isos.cfg | 62 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/boot/isos.cfg b/boot/isos.cfg index 268ddc9..6b70143 100644 --- a/boot/isos.cfg +++ b/boot/isos.cfg @@ -2,14 +2,49 @@ # insmod regexp -set isopath="/boot/isos" -export isopath - set isoconfdir="${isoconfig}.d" export isoconfdir -if [ -d "${isoconfdir}" ]; then - echo "${isoconfdir} is a directory" +if [ ! -d "${isoconfdir}" ]; then + echo "Cannot read ${isoconfdir}" + exit +fi + +# Loop over both FAT32 and ExFAT filesystems +isouuids="EAB6-E0E9 0BB2-9158" + +for isouuid in $isouuids +do + + search --no-floppy --fs-uuid --set=isodev $isouuid + set isopath="/isos" + + set isoroot="(${isodev})${isopath}" + + if [ ! -d "${isoroot}" ]; then + echo "Ignoring invalid iso root at ${isoroot}" + sleep 1 + continue + fi + + # split isoroot again + echo "Found iso root at ${isoroot}" + + regexp \ + --set 1:isodev \ + --set 2:isopath \ + "^(\(.*\))?(.*)\$" "${isoroot}" + + echo "isodev: ${isodev}" + echo "isopath: ${isopath}" + + # Export the variables + export isoroot + export isopath + export isodev + + # Read appropriate iso configs + echo "Reading ${isoconfdir}" for conf in ${isoconfdir}/*.cfg; do if [ ! -f "$conf" ]; then echo "No valid configuration to read" @@ -20,12 +55,15 @@ if [ -d "${isoconfdir}" ]; then source "${conf}" done - menuentry ' ' { true } + sleep 1 +done - menuentry "[Esc] Back to Menu" { - configfile "${prefix}/grub.cfg" - } -else - echo "Cannot read ${isoconfdir}" -fi +# let the echos be readable +echo "Waiting for 5 seconds..." +sleep 5 +menuentry ' ' { true } + +menuentry "[Esc] Back to Menu" { + configfile "${prefix}/grub.cfg" +}