Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions archinstall/lib/disk/disk_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def _boot_partition(sector_size: SectorSize, using_gpt: bool) -> PartitionModifi
# boot partition
return PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=start,
length=size,
mountpoint=Path('/boot'),
Expand Down Expand Up @@ -655,7 +655,7 @@ async def suggest_single_disk_layout(

root_partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=root_start,
length=root_length,
mountpoint=Path('/') if not using_subvolumes else None,
Expand All @@ -680,7 +680,7 @@ async def suggest_single_disk_layout(

home_partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=home_start,
length=home_length,
mountpoint=Path('/home'),
Expand Down Expand Up @@ -765,7 +765,7 @@ async def suggest_multi_disk_layout(
# add root partition to the root device
root_partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=root_start,
length=root_length,
mountpoint=Path('/'),
Expand All @@ -787,7 +787,7 @@ async def suggest_multi_disk_layout(
# add home partition to home device
home_partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=home_start,
length=home_length,
mountpoint=Path('/home'),
Expand Down
4 changes: 2 additions & 2 deletions archinstall/lib/disk/partitioning_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def table_data(self) -> dict[str, str]:

part_mod = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType._Unknown,
type=PartitionType._UNKNOWN,
start=self.segment.start,
length=self.segment.length,
)
Expand Down Expand Up @@ -527,7 +527,7 @@ async def _create_new_partition(self, free_space: FreeSpace) -> PartitionModific

partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=free_space.start,
length=length,
fs_type=fs_type,
Expand Down
16 changes: 8 additions & 8 deletions archinstall/lib/models/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,23 +720,23 @@ def __hash__(self) -> int:
return hash(self.disk.device.path)


class PartitionType(Enum):
Boot = 'boot'
Primary = 'primary'
_Unknown = 'unknown'
class PartitionType(StrEnum):
BOOT = auto()
PRIMARY = auto()
_UNKNOWN = 'unknown'

@classmethod
def get_type_from_code(cls, code: int) -> Self:
if code == parted.PARTITION_NORMAL:
return cls.Primary
return cls.PRIMARY
else:
debug(f'Partition code not supported: {code}')
return cls._Unknown
return cls._UNKNOWN

def get_partition_code(self) -> int | None:
if self == PartitionType.Primary:
if self == PartitionType.PRIMARY:
return parted.PARTITION_NORMAL
elif self == PartitionType.Boot:
elif self == PartitionType.BOOT:
return parted.PARTITION_BOOT
return None

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ After running ``python -m archinstall test_installer`` it should print something
_PartitionInfo(
partition=<parted.partition.Partition object at 0x7fbe166c4a90>,
name='primary',
type=<PartitionType.Primary: 'primary'>,
type=<PartitionType.PRIMARY: 'primary'>,
fs_type=<FilesystemType.FAT32: 'fat32'>,
path='/dev/nvme0n1p1',
start=Size(value=2048, unit=<Unit.sectors: 'sectors'>, sector_size=SectorSize(value=512, unit=<Unit.B: 1>)),
Expand Down
6 changes: 3 additions & 3 deletions examples/full_automated_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# create a new boot partition
boot_partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=Size(1, Unit.MiB, device.device_info.sector_size),
length=Size(512, Unit.MiB, device.device_info.sector_size),
mountpoint=Path('/boot'),
Expand All @@ -50,7 +50,7 @@
# create a root partition
root_partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=Size(513, Unit.MiB, device.device_info.sector_size),
length=Size(20, Unit.GiB, device.device_info.sector_size),
mountpoint=None,
Expand All @@ -65,7 +65,7 @@
# create a new home partition
home_partition = PartitionModification(
status=ModificationStatus.CREATE,
type=PartitionType.Primary,
type=PartitionType.PRIMARY,
start=start_home,
length=length_home,
mountpoint=Path('/home'),
Expand Down
Loading