Skip to content

Commit

Permalink
Fix boot partition regression (#1942)
Browse files Browse the repository at this point in the history
* Fix boot partition regression

* Fix spelling
  • Loading branch information
codefiles authored Jul 25, 2023
1 parent 69c37e7 commit d76f4a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 8 additions & 6 deletions archinstall/lib/disk/device_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,20 +789,22 @@ def get_efi_partition(self) -> Optional[PartitionModification]:
"""
Similar to get_boot_partition() but excludes XBOOTLDR partitions from it's candidates.
"""
fliltered = filter(lambda x: x.is_boot() and x.fs_type == FilesystemType.Fat32 and PartitionFlag.XBOOTLDR not in x.flags, self.partitions)
return next(fliltered, None)
filtered = filter(lambda x: x.is_boot() 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()
"""
if efi_partition := self.get_efi_partition():
fliltered = filter(lambda x: x.is_boot() and x != efi_partition and x.mountpoint, self.partitions)
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
else:
fliltered = filter(lambda x: x.is_boot() and x.mountpoint, self.partitions)

return next(fliltered, None)
filtered = filter(lambda x: x.is_boot() and x.mountpoint, self.partitions)
return next(filtered, None)

def get_root_partition(self, relative_path: Optional[Path]) -> Optional[PartitionModification]:
filtered = filter(lambda x: x.is_root(relative_path), self.partitions)
Expand Down
9 changes: 5 additions & 4 deletions archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,11 @@ def _add_systemd_bootloader(
# TODO: Ideally we would want to check if another config
# points towards the same disk and/or partition.
# And in which case we should do some clean up.
bootctl_options = [
f'--esp-path={efi_partition.mountpoint}' if efi_partition else '',
f'--boot-path={boot_partition.mountpoint}' if boot_partition else ''
]
bootctl_options = []

if efi_partition and boot_partition != efi_partition:
bootctl_options.append(f'--esp-path={efi_partition.mountpoint}')
bootctl_options.append(f'--boot-path={boot_partition.mountpoint}')

# Install the boot loader
try:
Expand Down

0 comments on commit d76f4a0

Please sign in to comment.