diff --git a/mbusb.cfg b/mbusb.cfg index 7e7bf29f..a7a0c6c1 100644 --- a/mbusb.cfg +++ b/mbusb.cfg @@ -1,7 +1,9 @@ # Partition holding files +regexp --set=rootdisk "^(.*),.*" "$root" +regexp --set=rootpartnum "^.*,.*([0-9]+)" "$root" probe -u $root --set=rootuuid set imgdevpath="/dev/disk/by-uuid/$rootuuid" -export imgdevpath rootuuid +export imgdevpath rootuuid rootdisk rootpartnum # Custom variables set isopath="/boot/isos" @@ -67,6 +69,18 @@ function search_files { } fi done + + if [ "x$grub_platform" == "xefi" ]; then + for efifile in /efi/boot/bootx64.efi; do + if [ -e "$efifile" ]; then + menuentry "EFI boot ($efifile)" "$efifile" { + efi_file="$2" + chainloader "$efi_file" + } + fi + done + fi + } # MultiBoot USB menu @@ -92,6 +106,22 @@ submenu "Multiboot ->" { done } + # Search partitions for boot files + submenu "Auto-detect bootable partitions ->" { + echo -n "Searching pendrive's partitions... " + for part in ($rootdisk,*); do + regexp --set=partnum "^.*,.*([0-9]+)" "$part" + if [ "$partnum" -le "$rootpartnum" ]; then continue; fi + submenu "$part ->" "$part" { + part_name="$2" + probe --fs-uuid $part_name --set=part_uuid + search --fs-uuid --no-floppy --hint=$part_name --set=root $part_uuid + # Look for boot files + search_files $root + } + done + } + # Search ISO files for boot files submenu "Auto-detect ISO's configfiles ->" { echo -n "Looking for ISO files... "