File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 44import logging
55import os
66import time
7- import uuid
87from collections .abc import Iterable
98from pathlib import Path
109from typing import Any , Literal
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 )
Original file line number Diff line number Diff 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
595599class FilesystemType (Enum ):
You can’t perform that action at this time.
0 commit comments