Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-07-03 15:10:23 +0200
committerAnton Hvornum <anton@hvornum.se>2021-07-03 15:10:23 +0200
commit57bad26553166d6c1bfa81576089a29d56c970a7 (patch)
tree141e49917a45a17e6985a9bd14c108ca35c467bd /archinstall/lib/user_interaction.py
parent51f2eca60e9d77a2675ed8828c2fdadfd065b7a2 (diff)
Added options to mark/unmark partitions for formatting (useful when re-using partitions, and fine tune which data to save and which to wipe). Setting a desired filesystem for a partition (both new ones and the ones being re-used).
Diffstat (limited to 'archinstall/lib/user_interaction.py')
-rw-r--r--archinstall/lib/user_interaction.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 91456626..9f4ddc6d 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -614,8 +614,10 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
"Delete a partition" if len(block_device_struct) else "",
"Clear/Delete all partitions" if len(block_device_struct) else "",
"Assign mount-point for a partition" if len(block_device_struct) else "",
+ "Mark/Unmark a partition to be formatted (wipes data)" if len(block_device_struct) else "",
"Mark/Unmark a partition as encrypted" if len(block_device_struct) else "",
- "Mark/Unmark a partition as bootable (automatic for /boot)" if len(block_device_struct) else ""
+ "Mark/Unmark a partition as bootable (automatic for /boot)" if len(block_device_struct) else "",
+ "Set desired filesystem for a partition" if len(block_device_struct) else "",
]
# Print current partition layout:
@@ -697,6 +699,11 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
else:
del(block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['mountpoint'])
+ elif task == "Mark/Unmark a partition to be formatted (wipes data)":
+ if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to mask for formatting: ', options_output=False)):
+ # Negate the current encryption marking
+ block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['format'] = not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('format', False)
+
elif task == "Mark/Unmark a partition as encrypted":
if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to mark as encrypted: ', options_output=False)):
# Negate the current encryption marking
@@ -706,6 +713,20 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to mark as bootable: ', options_output=False)):
block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['boot'] = not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('boot', False)
+ elif task == "Set desired filesystem for a partition":
+ if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to set a filesystem on: ', options_output=False)):
+ if not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('filesystem', None):
+ block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['filesystem'] = {}
+
+ while True:
+ fstype = input("Enter a desired filesystem type for the partition: ").strip()
+ if not valid_fs_type(fstype):
+ log(f"Desired filesystem {fstype} is not a valid filesystem.", level=logging.ERROR, fg="red")
+ continue
+ break
+
+ block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['filesystem']['format'] = fstype
+
return block_device_struct
def select_individual_blockdevice_usage(block_devices :list):