Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/disk/device_handler.py4
-rw-r--r--archinstall/lib/disk/device_model.py1
-rw-r--r--archinstall/lib/installer.py50
3 files changed, 36 insertions, 19 deletions
diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py
index d46275d1..7731bbc3 100644
--- a/archinstall/lib/disk/device_handler.py
+++ b/archinstall/lib/disk/device_handler.py
@@ -117,6 +117,10 @@ class DeviceHandler(object):
return part
return None
+ def get_parent_device_path(self, dev_path: Path) -> Path:
+ lsblk = get_lsblk_info(dev_path)
+ return Path(f'/dev/{lsblk.pkname}')
+
def get_uuid_for_path(self, path: Path) -> Optional[str]:
partition = self.find_partition(path)
return partition.partuuid if partition else None
diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py
index 8ea4e06e..7611eda5 100644
--- a/archinstall/lib/disk/device_model.py
+++ b/archinstall/lib/disk/device_model.py
@@ -1083,7 +1083,6 @@ def get_lsblk_info(dev_path: Union[Path, str]) -> LsblkInfo:
def get_all_lsblk_info() -> List[LsblkInfo]:
return _fetch_lsblk_info()
-
def get_lsblk_by_mountpoint(mountpoint: Path, as_prefix: bool = False) -> List[LsblkInfo]:
def _check(infos: List[LsblkInfo]) -> List[LsblkInfo]:
devices = []
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index ba57a001..7337fe6f 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -880,17 +880,31 @@ class Installer:
self.pacman.strap('efibootmgr') # TODO: Do we need? Yes, but remove from minimal_installation() instead?
try:
- SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --debug --target=x86_64-efi --efi-directory={boot_partition.mountpoint} --bootloader-id=GRUB --removable', peek_output=True)
+ 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
+ )
except SysCallError:
try:
- SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --debug --target=x86_64-efi --efi-directory={boot_partition.mountpoint} --bootloader-id=GRUB --removable', peek_output=True)
+ 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
+ )
except SysCallError as err:
raise DiskError(f"Could not install GRUB to {self.target}{boot_partition.mountpoint}: {err}")
else:
- device = disk.device_handler.get_device_by_partition_path(boot_partition.safe_dev_path)
-
- if not device:
- raise ValueError(f'Can not find block device: {boot_partition.safe_dev_path}')
+ parent_dev_path = disk.device_handler.get_parent_device_path(boot_partition.safe_dev_path)
try:
cmd = f'/usr/bin/arch-chroot' \
@@ -898,14 +912,17 @@ class Installer:
f' grub-install' \
f' --debug' \
f' --target=i386-pc' \
- f' --recheck {device.device_info.path}'
+ f' --recheck {parent_dev_path}'
SysCommand(cmd, peek_output=True)
except SysCallError as err:
raise DiskError(f"Failed to install GRUB boot on {boot_partition.dev_path}: {err}")
try:
- SysCommand(f'/usr/bin/arch-chroot {self.target} grub-mkconfig -o {boot_partition.mountpoint}/grub/grub.cfg')
+ SysCommand(
+ f'/usr/bin/arch-chroot {self.target} '
+ f'grub-mkconfig -o {boot_partition.mountpoint}/grub/grub.cfg'
+ )
except SysCallError as err:
raise DiskError(f"Could not configure GRUB: {err}")
@@ -923,10 +940,6 @@ class Installer:
# partition before the format.
root_uuid = get_lsblk_info(root_partition.safe_dev_path).uuid
- device = disk.device_handler.get_device_by_partition_path(boot_partition.safe_dev_path)
- if not device:
- raise ValueError(f'Can not find block device: {boot_partition.safe_dev_path}')
-
def create_pacman_hook(contents: str):
HOOK_DIR = "/etc/pacman.d/hooks"
SysCommand(f"/usr/bin/arch-chroot {self.target} mkdir -p {HOOK_DIR}")
@@ -940,6 +953,8 @@ class Installer:
f' cp' \
f' /usr/share/limine/BOOTX64.EFI' \
f' /boot/EFI/BOOT/'
+
+ SysCommand(cmd, peek_output=True)
except SysCallError as err:
raise DiskError(f"Failed to install Limine BOOTX64.EFI on {boot_partition.dev_path}: {err}")
@@ -957,6 +972,8 @@ When = PostTransaction
Exec = /usr/bin/cp /usr/share/limine/BOOTX64.EFI /boot/EFI/BOOT/
""")
else:
+ parent_dev_path = disk.device_handler.get_parent_device_path(boot_partition.safe_dev_path)
+
try:
# The `limine.sys` file, contains stage 3 code.
cmd = f'/usr/bin/arch-chroot' \
@@ -972,7 +989,7 @@ Exec = /usr/bin/cp /usr/share/limine/BOOTX64.EFI /boot/EFI/BOOT/
f' {self.target}' \
f' limine' \
f' bios-install' \
- f' {device.device_info.path}'
+ f' {parent_dev_path}'
SysCommand(cmd, peek_output=True)
except SysCallError as err:
@@ -1062,13 +1079,10 @@ TIMEOUT=5
debug(f'Root partition is an encrypted device identifying by PARTUUID: {root_partition.partuuid}')
kernel_parameters.append(f'root=PARTUUID={root_partition.partuuid} rw rootfstype={root_partition.safe_fs_type.value} {" ".join(self._kernel_params)}')
- device = disk.device_handler.get_device_by_partition_path(boot_partition.safe_dev_path)
-
- if not device:
- raise ValueError(f'Unable to find block device: {boot_partition.safe_dev_path}')
+ parent_dev_path = disk.device_handler.get_parent_device_path(boot_partition.safe_dev_path)
cmd = f'efibootmgr ' \
- f'--disk {device.device_info.path} ' \
+ f'--disk {parent_dev_path} ' \
f'--part {boot_partition.safe_dev_path} ' \
f'--create ' \
f'--label "{label}" ' \