From 3f954bbcb54fc25c5fdb6dc1ff47861ab1d79664 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Tue, 17 Feb 2026 07:22:23 -0500 Subject: [PATCH] Move get_parent_device_path() to disk.utils --- archinstall/lib/disk/device_handler.py | 4 ---- archinstall/lib/disk/utils.py | 5 +++++ archinstall/lib/installer.py | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py index a18b48591f..7ed5a62e06 100644 --- a/archinstall/lib/disk/device_handler.py +++ b/archinstall/lib/disk/device_handler.py @@ -187,10 +187,6 @@ def find_partition(self, path: Path) -> _PartitionInfo | None: 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) -> str | None: partition = self.find_partition(path) return partition.partuuid if partition else None diff --git a/archinstall/lib/disk/utils.py b/archinstall/lib/disk/utils.py index 0e94df542b..6f4904658c 100644 --- a/archinstall/lib/disk/utils.py +++ b/archinstall/lib/disk/utils.py @@ -110,6 +110,11 @@ def disk_layouts() -> str: return lsblk_output.model_dump_json(indent=4) +def get_parent_device_path(dev_path: Path) -> Path: + lsblk = get_lsblk_info(dev_path) + return Path(f'/dev/{lsblk.pkname}') + + def get_unique_path_for_device(dev_path: Path) -> Path | None: paths = Path('/dev/disk/by-id').glob('*') linked_targets = {p.resolve(): p for p in paths} diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 55574b3576..cb37e99bee 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -19,6 +19,7 @@ from archinstall.lib.disk.utils import ( get_lsblk_by_mountpoint, get_lsblk_info, + get_parent_device_path, get_unique_path_for_device, mount, swapon, @@ -1381,7 +1382,7 @@ def _add_grub_bootloader( else: info(f'GRUB boot partition: {boot_partition.dev_path}') - parent_dev_path = device_handler.get_parent_device_path(boot_partition.safe_dev_path) + parent_dev_path = get_parent_device_path(boot_partition.safe_dev_path) add_options = [ '--target=i386-pc', @@ -1475,7 +1476,7 @@ def _add_limine_bootloader( info(f'Limine EFI partition: {efi_partition.dev_path}') - parent_dev_path = device_handler.get_parent_device_path(efi_partition.safe_dev_path) + parent_dev_path = get_parent_device_path(efi_partition.safe_dev_path) try: efi_dir_path = self.target / efi_partition.mountpoint.relative_to('/') / 'EFI' @@ -1538,7 +1539,7 @@ def _add_limine_bootloader( config_path = boot_limine_path / 'limine.conf' - parent_dev_path = device_handler.get_parent_device_path(boot_partition.safe_dev_path) + parent_dev_path = get_parent_device_path(boot_partition.safe_dev_path) if unique_path := get_unique_path_for_device(parent_dev_path): parent_dev_path = unique_path @@ -1635,7 +1636,7 @@ def _add_efistub_bootloader( loader = '/EFI/Linux/arch-{kernel}.efi' cmdline = [] - parent_dev_path = device_handler.get_parent_device_path(boot_partition.safe_dev_path) + parent_dev_path = get_parent_device_path(boot_partition.safe_dev_path) cmd_template = ( 'efibootmgr',