Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-06-14 22:38:39 +1000
committerGitHub <noreply@github.com>2022-06-14 14:38:39 +0200
commit5c3c1312a49e1c110d4c5825fbb8242868544900 (patch)
tree4dddbd849c5ea7d5a128f126849bc450bc69cda6 /archinstall/lib/disk
parent86531ef62f777f91ef2f4ca7d102abdfccb11ded (diff)
Update list manager (#1331)
* Rework partition management * Update * Update list manager * Update * Update Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/disk')
-rw-r--r--archinstall/lib/disk/partition.py35
1 files changed, 32 insertions, 3 deletions
diff --git a/archinstall/lib/disk/partition.py b/archinstall/lib/disk/partition.py
index 062c79ab..17c24d57 100644
--- a/archinstall/lib/disk/partition.py
+++ b/archinstall/lib/disk/partition.py
@@ -17,14 +17,16 @@ from .btrfs.btrfs_helpers import subvolume_info_from_path
from .btrfs.btrfssubvolumeinfo import BtrfsSubvolumeInfo
class Partition:
- def __init__(self,
+ def __init__(
+ self,
path: str,
block_device: BlockDevice,
part_id :Optional[str] = None,
filesystem :Optional[str] = None,
mountpoint :Optional[str] = None,
encrypted :bool = False,
- autodetect_filesystem :bool = True):
+ autodetect_filesystem :bool = True
+ ):
if not part_id:
part_id = os.path.basename(path)
@@ -76,7 +78,30 @@ class Partition:
else:
return f'Partition(path={self.path}, size={self.size}, PARTUUID={self._safe_uuid}, fs={self.filesystem}{mount_repr})'
+ def as_json(self) -> Dict[str, Any]:
+ """
+ this is used for the table representation of the partition (see FormattedOutput)
+ """
+ partition_info = {
+ 'type': 'primary',
+ 'PARTUUID': self._safe_uuid,
+ 'wipe': self.allow_formatting,
+ 'boot': self.boot,
+ 'ESP': self.boot,
+ 'mountpoint': self.target_mountpoint,
+ 'encrypted': self._encrypted,
+ 'start': self.start,
+ 'size': self.end,
+ 'filesystem': self.filesystem_type
+ }
+
+ return partition_info
+
def __dump__(self) -> Dict[str, Any]:
+ # TODO remove this in favour of as_json
+
+ log(get_filesystem_type(self.path))
+
return {
'type': 'primary',
'PARTUUID': self._safe_uuid,
@@ -88,11 +113,15 @@ class Partition:
'start': self.start,
'size': self.end,
'filesystem': {
- 'format': get_filesystem_type(self.path)
+ 'format': self.filesystem_type
}
}
@property
+ def filesystem_type(self) -> Optional[str]:
+ return get_filesystem_type(self.path)
+
+ @property
def mountpoint(self) -> Optional[str]:
try:
data = json.loads(SysCommand(f"findmnt --json -R {self.path}").decode())