Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Add submenu to look for some boot files
Browse files Browse the repository at this point in the history
For each available ISO file, mount it and look for some common boot
files (e.g. GRUB, SYSLINUX, etc.) and show menu entries for each one of
those.

This can be used to test unsupported ISO files.
  • Loading branch information
aguslr committed Oct 26, 2017
1 parent afdb139 commit 48b0873
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions mbusb.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,59 @@ if [ -e "$prefix/mbusb.cfg.local" ]; then
source "$prefix/mbusb.cfg.local"
fi

# Function to look for boot files
function search_files {
root="$1"

insmod bitmap
insmod jpeg
insmod png
insmod tga

for grubfile in \
/boot/grub/loopback.cfg \
/boot/grub/grub.cfg \
/boot/grub/x86_64-efi/grub.cfg \
/EFI/BOOT/grub.cfg; do
if [ -e "$grubfile" ]; then
menuentry "GRUB boot ($grubfile)" "$grubfile" {
grub_file="$2"
configfile "$grub_file"
}
fi
done

for syslinuxfile in \
/isolinux.cfg \
/syslinux.cfg \
/isolinux/isolinux.cfg \
/isolinux/syslinux.cfg \
/syslinux/isolinux.cfg \
/boot/isolinux.cfg \
/boot/isolinux/isolinux.cfg \
/boot/syslinux.cfg \
/boot/syslinux/isolinux.cfg \
/boot/syslinux/syslinux.cfg; do
if [ -e "$syslinuxfile" ]; then
menuentry "SYSLINUX boot ($syslinuxfile)" "$syslinuxfile" {
syslinux_file="$2"
syslinux_configfile -i "$syslinux_file"
}
fi
done

for legacyfile in \
/boot/grub/menu.lst \
/menu.lst; do
if [ -e "$legacyfile" ]; then
menuentry "GRUB legacy boot ($legacyfile)" "$legacyfile" {
legacy_file="$2"
legacy_configfile "$legacy_file"
}
fi
done
}

# MultiBoot USB menu
submenu "Multiboot ->" {

Expand All @@ -39,6 +92,25 @@ submenu "Multiboot ->" {
done
}

# Search ISO files for boot files
submenu "Auto-detect ISO's configfiles ->" {
echo -n "Looking for ISO files... "
for isofile in $isopath/*.iso $isopath/*.img; do
if [ -e "$isofile" ]; then
regexp --set=isoname "$isopath/(.*)" "$isofile"
submenu "$isoname ->" "$isofile" {
iso_path="$2"
export iso_path
search --set=root --file "$iso_path"
loopback loop "$iso_path"
root=(loop)
# Look for boot files
search_files $root
}
fi
done
}

# Use MEMDISK to load ISO files
submenu "Use MEMDISK to boot ISO files ->" {
echo -n "Looking for ISO files... "
Expand Down

0 comments on commit 48b0873

Please sign in to comment.