Skip to content

Commit 97075f7

Browse files
committed
Refactor partition type GUID
1 parent 20cc124 commit 97075f7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

archinstall/lib/disk/device_handler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import logging
55
import os
66
import time
7-
import uuid
87
from collections.abc import Iterable
98
from pathlib import Path
109
from typing import Any, Literal
@@ -29,6 +28,7 @@
2928
LvmVolumeGroup,
3029
LvmVolumeInfo,
3130
ModificationStatus,
31+
PartitionGUID,
3232
PartitionModification,
3333
PartitionTable,
3434
SectorSize,
@@ -544,8 +544,7 @@ def _setup_partition(
544544
raise DiskError(f'Unable to add partition, most likely due to overlapping sectors: {ex}') from ex
545545

546546
if disk.type == PartitionTable.GPT.value and part_mod.is_root():
547-
linux_root_x86_64 = "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709"
548-
partition.type_uuid = uuid.UUID(linux_root_x86_64).bytes
547+
partition.type_uuid = PartitionGUID.LINUX_ROOT_X86_64.bytes
549548

550549
# the partition has a path now that it has been added
551550
part_mod.dev_path = Path(partition.path)

archinstall/lib/disk/device_model.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,11 +585,15 @@ class PartitionFlag(Enum):
585585
ESP = parted.PARTITION_ESP
586586

587587

588-
# class PartitionGUIDs(Enum):
589-
# """
590-
# A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
591-
# """
592-
# XBOOTLDR = 'bc13c2ff-59e6-4262-a352-b275fd6f7172'
588+
class PartitionGUID(Enum):
589+
"""
590+
A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
591+
"""
592+
LINUX_ROOT_X86_64 = "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709"
593+
594+
@property
595+
def bytes(self) -> bytes:
596+
return uuid.UUID(self.value).bytes
593597

594598

595599
class FilesystemType(Enum):

0 commit comments

Comments
 (0)