Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/device_model.py
diff options
context:
space:
mode:
authorThomas Aldrian <aldrian.thom+github@proton.me>2023-09-23 03:11:21 +0100
committerGitHub <noreply@github.com>2023-09-23 12:11:21 +1000
commitad6cbcfd3d5e21177150dd82f9c00661dff4e98e (patch)
tree989151a5c481e02f4c5ee5f2cfdf8059d2d0aa2a /archinstall/lib/disk/device_model.py
parentca3051ebf3ddd45f90a3bd3244df4640fb0b1c58 (diff)
Fix GRUB with non-/boot ESP (#2015)
* Fix GRUB with non-/boot ESP Fixes #2001 * GRUB EFI fixes * Fix flake8 and mypy --------- Co-authored-by: Anton Hvornum <anton@hvornum.se> Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/disk/device_model.py')
-rw-r--r--archinstall/lib/disk/device_model.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py
index ec0207a1..ad2628ae 100644
--- a/archinstall/lib/disk/device_model.py
+++ b/archinstall/lib/disk/device_model.py
@@ -800,20 +800,25 @@ class DeviceModification:
def get_efi_partition(self) -> Optional[PartitionModification]:
"""
Similar to get_boot_partition() but excludes XBOOTLDR partitions from it's candidates.
+ Also works with ESP flag.
"""
- filtered = filter(lambda x: x.is_boot() and x.fs_type == FilesystemType.Fat32 and PartitionFlag.XBOOTLDR not in x.flags, self.partitions)
+ filtered = filter(lambda x: (x.is_boot() or PartitionFlag.ESP in x.flags) and x.fs_type == FilesystemType.Fat32 and PartitionFlag.XBOOTLDR not in x.flags, self.partitions)
return next(filtered, None)
def get_boot_partition(self) -> Optional[PartitionModification]:
"""
Returns the first partition marked as XBOOTLDR (PARTTYPE id of bc13c2ff-...) or Boot and has a mountpoint.
Only returns XBOOTLDR if separate EFI is detected using self.get_efi_partition()
+ Will return None if no suitable partition is found.
"""
if efi_partition := self.get_efi_partition():
filtered = filter(lambda x: x.is_boot() and x != efi_partition and x.mountpoint, self.partitions)
if boot_partition := next(filtered, None):
return boot_partition
- return efi_partition
+ if efi_partition.is_boot():
+ return efi_partition
+ else:
+ return None
else:
filtered = filter(lambda x: x.is_boot() and x.mountpoint, self.partitions)
return next(filtered, None)