Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-09-17 03:14:47 -0400
committerGitHub <noreply@github.com>2023-09-17 17:14:47 +1000
commitb9d962bec2466d096b38c5c4e519e79c0162a0eb (patch)
treed1be46109ba2cb269ec0b7dcd2bff1c56f330acb /archinstall/lib
parentf4a6d11373c61f77236f95b2a97f505c6eab55a2 (diff)
Refactor `_add_grub_bootloader()` installation (#1968)
* Refactor `_add_grub_bootloader()` installation * Remove whitespace
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/installer.py52
1 files changed, 25 insertions, 27 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index d010e8a1..c32069c3 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -876,45 +876,43 @@ class Installer:
info(f"GRUB boot partition: {boot_partition.dev_path}")
+ command = [
+ '/usr/bin/arch-chroot',
+ str(self.target),
+ 'grub-install',
+ '--debug'
+ ]
+
if SysInfo.has_uefi():
self.pacman.strap('efibootmgr') # TODO: Do we need? Yes, but remove from minimal_installation() instead?
+ add_options = [
+ '--target=x86_64-efi',
+ f'--efi-directory={boot_partition.mountpoint}',
+ '--bootloader-id=GRUB',
+ '--removable'
+ ]
+
+ command.extend(add_options)
+
try:
- SysCommand(
- f'/usr/bin/arch-chroot {self.target} grub-install '
- f'--debug '
- f'--target=x86_64-efi '
- f'--efi-directory={boot_partition.mountpoint} '
- f'--bootloader-id=GRUB '
- f'--removable',
- peek_output=True
- )
+ SysCommand(command, peek_output=True)
except SysCallError:
try:
- SysCommand(
- f'/usr/bin/arch-chroot {self.target} '
- f'grub-install '
- f'--debug '
- f'--target=x86_64-efi '
- f'--efi-directory={boot_partition.mountpoint} '
- f'--bootloader-id=GRUB '
- f'--removable',
- peek_output=True
- )
+ SysCommand(command, peek_output=True)
except SysCallError as err:
raise DiskError(f"Could not install GRUB to {self.target}{boot_partition.mountpoint}: {err}")
else:
parent_dev_path = disk.device_handler.get_parent_device_path(boot_partition.safe_dev_path)
- try:
- cmd = f'/usr/bin/arch-chroot' \
- f' {self.target}' \
- f' grub-install' \
- f' --debug' \
- f' --target=i386-pc' \
- f' --recheck {parent_dev_path}'
+ add_options = [
+ '--target=i386-pc',
+ '--recheck',
+ str(parent_dev_path)
+ ]
- SysCommand(cmd, peek_output=True)
+ try:
+ SysCommand(command + add_options, peek_output=True)
except SysCallError as err:
raise DiskError(f"Failed to install GRUB boot on {boot_partition.dev_path}: {err}")