grub.cfg: optimize search_isolinux

GRUB is slow at device enumeration. This patch works around it in the same way
as vitali64's recent patch.
This commit is contained in:
Leah Rowe 2021-12-29 02:37:05 +00:00
parent 56698000fa
commit 0ea263129a
1 changed files with 14 additions and 9 deletions

View File

@ -77,16 +77,21 @@ function try_isolinux_config {
done done
} }
function search_isolinux { function search_isolinux {
unset ddev for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
if [ (${1}?) != "(${1}?)" ]; then # TODO : Find a better way to detect how many partitions
ddev=(${1}*) # Both raw and partitioned devices. # : are on the disk instead of hardcoding.
echo -n "Attempting to parse isolinux menu from: " echo "\nAttempting to parse isolinux menu from ${1}${i}"
fi for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
for i in ${ddev}; do # MBR/GPT partitions
echo -n "${i} " echo "\nTrying partiton ${part}"
try_isolinux_config "${i}" try_isolinux_config "(${1}${i},${part})"
done done
# raw devices
echo "\nTrying raw usb device ..."
try_isolinux_config "(${1}${i})"
echo # Insert newline echo # Insert newline
done
} }
menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o' { menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o' {
# GRUB2 handles (almost) every possible disk setup, but only the location of # GRUB2 handles (almost) every possible disk setup, but only the location of