Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-06-13 10:34:08 +0200
committerAnton Hvornum <anton@hvornum.se>2021-06-13 10:34:08 +0200
commit858171986c2b1111c52df4b7398c366dd15921f0 (patch)
treeaeb806e2416f89a4767e1f651ad0fc66e9fae968 /archinstall/lib/disk.py
parent24476ac1f696c882fb2f741cb8c5fa858f786f46 (diff)
Working suggested single disk layout, preparing for multiple selections.
Diffstat (limited to 'archinstall/lib/disk.py')
-rw-r--r--archinstall/lib/disk.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 7a7fce5e..abe34af1 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -27,6 +27,60 @@ def valid_fs_type(fstype :str) -> bool:
"btrfs",
]
+def suggest_single_disk_layout(blockdevice):
+ MIN_SIZE_TO_ALLOW_HOME_PART = 40 # Gb
+
+ layout = {
+ blockdevice : {
+ "wipe" : True,
+ "partitions" : []
+ }
+ }
+
+ layout[blockdevice]['partitions'].append({
+ # Boot
+ "type" : "primary",
+ "start" : "1MiB",
+ "size" : "513MiB",
+ "boot" : True,
+ "format" : True,
+ "mountpoint" : "/boot",
+ "filesystem" : {
+ "format" : "fat32"
+ }
+ })
+ layout[blockdevice]['partitions'].append({
+ # Root
+ "type" : "primary",
+ "start" : "513MiB",
+ "encrypted" : True,
+ "format" : True,
+ "size" : "100%" if blockdevice.size < MIN_SIZE_TO_ALLOW_HOME_PART else f"{min(blockdevice.size, 20)*1024}MiB",
+ "mountpoint" : "/",
+ "filesystem" : {
+ "format" : "btrfs"
+ }
+ })
+
+ if blockdevice.size > MIN_SIZE_TO_ALLOW_HOME_PART:
+ layout[blockdevice]['partitions'].append({
+ # Home
+ "type" : "primary",
+ "encrypted" : True,
+ "format" : True,
+ "start" : f"{min(blockdevice.size*0.2, 20)*1024}MiB",
+ "size" : "100%",
+ "mountpoint" : "/home",
+ "filesystem" : {
+ "format" : "btrfs"
+ }
+ })
+
+ return layout
+
+def suggest_multi_disk_layout(blockdevices):
+ pass
+
class BlockDevice:
def __init__(self, path, info=None):
@@ -323,6 +377,7 @@ class Partition:
This is more reliable than relying on /dev/disk/by-partuuid as
it doesn't seam to be able to detect md raid partitions.
"""
+
lsblk = json.loads(SysCommand(f'lsblk -J -o+PARTUUID {self.path}').decode('UTF-8'))
for partition in lsblk['blockdevices']:
return partition.get('partuuid', None)