Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/validators.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-10-30 20:52:07 +0200
committerGitHub <noreply@github.com>2021-10-30 20:52:07 +0200
commit85c97b56301e2131ee0606bcce7dffb4456bb580 (patch)
tree6b47a27bb6286880e497c5e7c7bd2f0d8848c0ec /archinstall/lib/disk/validators.py
parentd25a20a7f28dcd873747c2a2842504c919b6e884 (diff)
parent2a2239dd03bb64d3410469fd190fed34b252cf53 (diff)
Merged PR #637 - BTRFS support fix #93
+ BTRFS support + Refactoring of `disk.py` into `lib/disk/*.py` + `get_mount_info()` was reworked to support traverse backwards until mountpoint information is found (reverse-recursiveness) + `suggest_single_disk_layout()` was added/fixed to support BTRFS options + - `suggest_multi_disk_layout()` does not yet support BTRFS subvolumes in suggestive mode + `Installer()` now calls `create_subvolume()` and `mount_subvolume()` during loading of file structure on `mount_ordered_layout()`
Diffstat (limited to 'archinstall/lib/disk/validators.py')
-rw-r--r--archinstall/lib/disk/validators.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/archinstall/lib/disk/validators.py b/archinstall/lib/disk/validators.py
new file mode 100644
index 00000000..0c9f5a74
--- /dev/null
+++ b/archinstall/lib/disk/validators.py
@@ -0,0 +1,42 @@
+def valid_parted_position(pos :str):
+ if not len(pos):
+ return False
+
+ if pos.isdigit():
+ return True
+
+ if pos[-1] == '%' and pos[:-1].isdigit():
+ return True
+
+ if pos[-3:].lower() in ['mib', 'kib', 'b', 'tib'] and pos[:-3].replace(".", "", 1).isdigit():
+ return True
+
+ if pos[-2:].lower() in ['kb', 'mb', 'gb', 'tb'] and pos[:-2].replace(".", "", 1).isdigit():
+ return True
+
+ return False
+
+def valid_fs_type(fstype :str) -> bool:
+ # https://www.gnu.org/software/parted/manual/html_node/mkpart.html
+ # Above link doesn't agree with `man parted` /mkpart documentation:
+ """
+ fs-type can
+ be one of "btrfs", "ext2",
+ "ext3", "ext4", "fat16",
+ "fat32", "hfs", "hfs+",
+ "linux-swap", "ntfs", "reis‐
+ erfs", "udf", or "xfs".
+ """
+
+ return fstype.lower() in [
+ "btrfs",
+ "ext2",
+ "ext3", "ext4", # `man parted` allows these
+ "fat16", "fat32",
+ "hfs", "hfs+", # "hfsx", not included in `man parted`
+ "linux-swap",
+ "ntfs",
+ "reiserfs",
+ "udf", # "ufs", not included in `man parted`
+ "xfs", # `man parted` allows this
+ ] \ No newline at end of file