summaryrefslogtreecommitdiff
path: root/resources/grub
diff options
context:
space:
mode:
Diffstat (limited to 'resources/grub')
-rw-r--r--resources/grub/config/grub.cfg53
1 files changed, 23 insertions, 30 deletions
diff --git a/resources/grub/config/grub.cfg b/resources/grub/config/grub.cfg
index 93cc9e2c..3820fb55 100644
--- a/resources/grub/config/grub.cfg
+++ b/resources/grub/config/grub.cfg
@@ -109,16 +109,22 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
search_grub ahci
search_grub ata
# 2) LVM and RAID which might be used accross multiple devices
- unset lvmvol
- for vol in bootvol rootvol; do
- if [ (lvm\/?atrix-${vol}) != "(lvm/?atrix-${vol})" ]; then # Sketchy check, hardcoded string to be dropped in future
- lvmvol="${lvmvol} (lvm/matrix-${vol})"
- fi
- done
- unset raidvol
- if [ (md/?) != "(md/?)" ] ; then
- raidvol=(md/?)
- fi
+ lvmvol="lvm/matrix-bootvol lvm/matrix-rootvol"
+ # TODO: add more entries to this string in the future, with common
+ # volume group names per common distro configs. look at what all the
+ # popular distros are doing when the user select automatic partitioning
+ # in their distro's installer. this still won't cover all use cases,
+ # but grub's enumeration of anything partition-related is very slow,
+ # so for now we hardcode everything in grub.cfg
+
+ # again, hardcoded. grub's enumeration is always very slow.
+ # until that is optimized, we must hardcode everything in grub.cfg
+ raidvol="md/0 md/1 md/2 md/3 md/4 md/5 md/6 md/7 md/8 md/9"
+
+ # in practise, doing multiple redundant checks is perfectly fast and
+ # ok, even if less technically correct
+ # TODO: optimize grub itself, and use */? here for everything
+
for vol in ${lvmvol} ${raidvol} ; do
try_user_config "${vol}"
done
@@ -129,22 +135,15 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
# Encrypted disks and partitions
#TODO: This needs to be adjusted on each device to exclude ODD
#TODO: Usually ATA is for odd if both exist!
-#TODO: Unset variables before use!
-#TODO: Pick better variable name scheme than ${ddev}, or find way to make it local
unset ahcidev
unset atadev
- if [ (ahci?) != "(ahci?)" ]; then
- ahcilist=(ahci*)
- for part in ${ahcilist}; do
- ahcidev="$part $ahcidev"
+ for i in 11 10 9 8 7 6 5 4 3 2 1 0; do
+ for part in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1; do
+ ahcidev="(ahci${i},${part}) ${ahcidev}"
+ atadev="(ata${i},${part}) ${atadev}"
done
- fi
- if [ (ata?) != "(ata?)" ]; then
- atalist=(ata*)
- for part in ${atalist}; do
- atadev="$part $atadev"
- done
- fi
+ done
+
set pager=0
echo -n "Attempting to cryptomount: "
for dev in ${ahcidev} ${atadev} ${lvmvol} ${raidvol}; do
@@ -154,13 +153,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
set pager=1
echo # Insert newline
-# Rescan lvm volumes, should probably use test at this point
- unset lvmvol
- for vol in bootvol rootvol; do
- if [ (lvm\/?atrix-${vol}) != "(lvm/?atrix-${vol})" ]; then # Sketchy check, hardcoded string to be dropped in future
- lvmvol="${lvmvol} (lvm/matrix-${vol})"
- fi
- done
+# Retry lvm volumes, because after cryptomount, they might now be exposed
# 3) LVM inside LUKS containers
for vol in ${lvmvol}; do