MCPcopy Index your code
hub / github.com/archlinux/archinstall / DeviceModification

Class DeviceModification

archinstall/lib/models/device.py:1398–1436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396
1397@dataclass
1398class DeviceModification:
1399 device: BDevice
1400 wipe: bool
1401 partitions: list[PartitionModification] = field(default_factory=list)
1402
1403 @property
1404 def device_path(self) -> Path:
1405 return self.device.device_info.path
1406
1407 def using_gpt(self, partition_table: PartitionTable) -> bool:
1408 if self.wipe:
1409 return partition_table.is_gpt()
1410
1411 return self.device.disk.type == PartitionTable.GPT.value
1412
1413 def add_partition(self, partition: PartitionModification) -> None:
1414 self.partitions.append(partition)
1415
1416 def get_efi_partition(self) -> PartitionModification | None:
1417 filtered = filter(lambda x: x.is_efi() and x.mountpoint, self.partitions)
1418 return next(filtered, None)
1419
1420 def get_boot_partition(self) -> PartitionModification | None:
1421 filtered = filter(lambda x: x.is_boot() and x.mountpoint, self.partitions)
1422 return next(filtered, None)
1423
1424 def get_root_partition(self) -> PartitionModification | None:
1425 filtered = filter(lambda x: x.is_root(), self.partitions)
1426 return next(filtered, None)
1427
1428 def json(self) -> _DeviceModificationSerialization:
1429 """
1430 Called when generating configuration files
1431 """
1432 return {
1433 'device': str(self.device.device_info.path),
1434 'wipe': self.wipe,
1435 'partitions': [p.json() for p in self.partitions],
1436 }
1437
1438
1439class EncryptionType(StrEnum):

Callers 7

showMethod · 0.90
_manual_partitioningFunction · 0.90
parse_argMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected