index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2021-06-14 19:04:51 +0200 |
---|---|---|
committer | Anton Hvornum <anton@hvornum.se> | 2021-06-14 19:04:51 +0200 |
commit | fa8862a46078a9684144853461e2c3ba99bda71c (patch) | |
tree | b3ef6b04428654dd185a2930018a707acb240381 /archinstall/lib/disk.py | |
parent | 6176ac5e5d6fc52740c2af73af89db7e413d3d2f (diff) |
-rw-r--r-- | archinstall/lib/disk.py | 18 |
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 8424bc24..c63a7b09 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -13,6 +13,24 @@ GPT = 0b00000001 MBR = 0b00000010 +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: |