Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-09-24 19:47:38 +1000
committerGitHub <noreply@github.com>2023-09-24 19:47:38 +1000
commitb141609990fa4f7305443ee6ea6fe8796604c539 (patch)
tree5326555c522bb3b3e128a579917c892593e9e2b9 /examples
parent9e3e4a5df5b6ff106bcbf30273cdb0de9af7e02e (diff)
Fix 1669 | Refactor display of sizes in tables (#2100)
* Use sector as default display * Display tables in sector size * Refactor size * Update * Update * fix flake8 --------- Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/config-sample.json17
-rw-r--r--examples/full_automated_installation.py15
2 files changed, 12 insertions, 20 deletions
diff --git a/examples/config-sample.json b/examples/config-sample.json
index ed1cc38e..d43f7ea6 100644
--- a/examples/config-sample.json
+++ b/examples/config-sample.json
@@ -17,9 +17,8 @@
"Boot"
],
"fs_type": "fat32",
- "length": {
+ "size": {
"sector_size": null,
- "total_size": null,
"unit": "MiB",
"value": 512
},
@@ -28,7 +27,6 @@
"obj_id": "2c3fa2d5-2c79-4fab-86ec-22d0ea1543c0",
"start": {
"sector_size": null,
- "total_size": null,
"unit": "MiB",
"value": 1
},
@@ -39,9 +37,8 @@
"btrfs": [],
"flags": [],
"fs_type": "ext4",
- "length": {
+ "size": {
"sector_size": null,
- "total_size": null,
"unit": "GiB",
"value": 20
},
@@ -50,7 +47,6 @@
"obj_id": "3e7018a0-363b-4d05-ab83-8e82d13db208",
"start": {
"sector_size": null,
- "total_size": null,
"unit": "MiB",
"value": 513
},
@@ -61,14 +57,8 @@
"btrfs": [],
"flags": [],
"fs_type": "ext4",
- "length": {
+ "size": {
"sector_size": null,
- "total_size": {
- "sector_size": null,
- "total_size": null,
- "unit": "B",
- "value": 250148290560
- },
"unit": "Percent",
"value": 100
},
@@ -77,7 +67,6 @@
"obj_id": "ce58b139-f041-4a06-94da-1f8bad775d3f",
"start": {
"sector_size": null,
- "total_size": null,
"unit": "GiB",
"value": 20
},
diff --git a/examples/full_automated_installation.py b/examples/full_automated_installation.py
index 79e85348..d25575d4 100644
--- a/examples/full_automated_installation.py
+++ b/examples/full_automated_installation.py
@@ -23,8 +23,8 @@ device_modification = disk.DeviceModification(device, wipe=True)
boot_partition = disk.PartitionModification(
status=disk.ModificationStatus.Create,
type=disk.PartitionType.Primary,
- start=disk.Size(1, disk.Unit.MiB),
- length=disk.Size(512, disk.Unit.MiB),
+ start=disk.Size(1, disk.Unit.MiB, device.device_info.sector_size),
+ length=disk.Size(512, disk.Unit.MiB, device.device_info.sector_size),
mountpoint=Path('/boot'),
fs_type=disk.FilesystemType.Fat32,
flags=[disk.PartitionFlag.Boot]
@@ -35,20 +35,23 @@ device_modification.add_partition(boot_partition)
root_partition = disk.PartitionModification(
status=disk.ModificationStatus.Create,
type=disk.PartitionType.Primary,
- start=disk.Size(513, disk.Unit.MiB),
- length=disk.Size(20, disk.Unit.GiB),
+ start=disk.Size(513, disk.Unit.MiB, device.device_info.sector_size),
+ length=disk.Size(20, disk.Unit.GiB, device.device_info.sector_size),
mountpoint=None,
fs_type=fs_type,
mount_options=[],
)
device_modification.add_partition(root_partition)
+start_home = root_partition.length
+length_home = device.device_info.total_size - start_home
+
# create a new home partition
home_partition = disk.PartitionModification(
status=disk.ModificationStatus.Create,
type=disk.PartitionType.Primary,
- start=root_partition.length,
- length=disk.Size(100, disk.Unit.Percent, total_size=device.device_info.total_size),
+ start=start_home,
+ length=length_home,
mountpoint=Path('/home'),
fs_type=fs_type,
mount_options=[]