Skip to content

Commit 3f954bb

Browse files
committed
Move get_parent_device_path() to disk.utils
1 parent f736b8c commit 3f954bb

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

archinstall/lib/disk/device_handler.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,6 @@ def find_partition(self, path: Path) -> _PartitionInfo | None:
187187
return part
188188
return None
189189

190-
def get_parent_device_path(self, dev_path: Path) -> Path:
191-
lsblk = get_lsblk_info(dev_path)
192-
return Path(f'/dev/{lsblk.pkname}')
193-
194190
def get_uuid_for_path(self, path: Path) -> str | None:
195191
partition = self.find_partition(path)
196192
return partition.partuuid if partition else None

archinstall/lib/disk/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ def disk_layouts() -> str:
110110
return lsblk_output.model_dump_json(indent=4)
111111

112112

113+
def get_parent_device_path(dev_path: Path) -> Path:
114+
lsblk = get_lsblk_info(dev_path)
115+
return Path(f'/dev/{lsblk.pkname}')
116+
117+
113118
def get_unique_path_for_device(dev_path: Path) -> Path | None:
114119
paths = Path('/dev/disk/by-id').glob('*')
115120
linked_targets = {p.resolve(): p for p in paths}

archinstall/lib/installer.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from archinstall.lib.disk.utils import (
2020
get_lsblk_by_mountpoint,
2121
get_lsblk_info,
22+
get_parent_device_path,
2223
get_unique_path_for_device,
2324
mount,
2425
swapon,
@@ -1381,7 +1382,7 @@ def _add_grub_bootloader(
13811382
else:
13821383
info(f'GRUB boot partition: {boot_partition.dev_path}')
13831384

1384-
parent_dev_path = device_handler.get_parent_device_path(boot_partition.safe_dev_path)
1385+
parent_dev_path = get_parent_device_path(boot_partition.safe_dev_path)
13851386

13861387
add_options = [
13871388
'--target=i386-pc',
@@ -1475,7 +1476,7 @@ def _add_limine_bootloader(
14751476

14761477
info(f'Limine EFI partition: {efi_partition.dev_path}')
14771478

1478-
parent_dev_path = device_handler.get_parent_device_path(efi_partition.safe_dev_path)
1479+
parent_dev_path = get_parent_device_path(efi_partition.safe_dev_path)
14791480

14801481
try:
14811482
efi_dir_path = self.target / efi_partition.mountpoint.relative_to('/') / 'EFI'
@@ -1538,7 +1539,7 @@ def _add_limine_bootloader(
15381539

15391540
config_path = boot_limine_path / 'limine.conf'
15401541

1541-
parent_dev_path = device_handler.get_parent_device_path(boot_partition.safe_dev_path)
1542+
parent_dev_path = get_parent_device_path(boot_partition.safe_dev_path)
15421543

15431544
if unique_path := get_unique_path_for_device(parent_dev_path):
15441545
parent_dev_path = unique_path
@@ -1635,7 +1636,7 @@ def _add_efistub_bootloader(
16351636
loader = '/EFI/Linux/arch-{kernel}.efi'
16361637
cmdline = []
16371638

1638-
parent_dev_path = device_handler.get_parent_device_path(boot_partition.safe_dev_path)
1639+
parent_dev_path = get_parent_device_path(boot_partition.safe_dev_path)
16391640

16401641
cmd_template = (
16411642
'efibootmgr',

0 commit comments

Comments
 (0)