From 36b3be95cf7521fcaa5779099b8882c9d48b8484 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 1 Jun 2024 17:04:31 +0100 Subject: [PATCH] grub.cfg: search a reduced list of devs/partitions in practise, the machines we support don't have the option of including so many disks; 8 seems like the most reasonable default. additionally, it's unreasonable to expect *20 partitions* this hardcoding is done to avoid using *, which is slow in grub on some machines (the grub kernel always re-enumerates the devices during every operation, without caching any of it) yet, the hardcoding is also slow; balance it a bit better by searching fewer permutations, but not so few that it would likely break a lot of setups Signed-off-by: Leah Rowe --- config/grub/config/grub.cfg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/grub/config/grub.cfg b/config/grub/config/grub.cfg index 6664271..5b67d11 100644 --- a/config/grub/config/grub.cfg +++ b/config/grub/config/grub.cfg @@ -81,8 +81,8 @@ function try_user_config { } function search_grub { echo -n "Attempting to load grub.cfg from '${1}' devices" - for i in 0 1 2 3 4 5 6 7 8 9 10 11; do - 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 0 1 2 3 4 5 6 7 8; do + for part in 1 2 3 4 5 6 7 8 9 10 11 12; do if [ "${1}" != "nvme" ]; then try_user_config "(${1}${i},${part})" else @@ -117,8 +117,8 @@ function try_isolinux_config { } function search_isolinux { echo "\nAttempting to parse iso/sys/extlinux config from '${1}' devices" - for i in 0 1 2 3 4 5 6 7 8 9 10 11; do - 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 0 1 2 3 4 5 6 7 8; do + for part in 1 2 3 4 5 6 7 8 9 10 11 12; do if [ "${1}" != "nvme" ]; then try_isolinux_config "(${1}${i},${part})" else @@ -167,8 +167,8 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o unset bootdev for grub_disk in ${grub_scan_disk}; do - for i in 0 1 2 3 4 5 6 7 8 9 10 11; do - 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 0 1 2 3 4 5 6 7 8; do + for part in 1 2 3 4 5 6 7 8 9 10 11 12; do if [ "${grub_disk}" = "ahci" ]; then bootdev="${bootdev} (ahci${i},${part})" elif [ "${grub_disk}" = "ata" ]; then