From f2b0fcc6524226c99e38edd3fa03a3a68af33738 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 4 Jul 2021 15:15:07 +0200 Subject: Added a filesystem check when marking for formatting, this should ensure that encrypted volumes get a proper filesystem without having to go through an extra step of selecting filesystem. --- archinstall/lib/disk.py | 1 + archinstall/lib/user_interaction.py | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index d6f6ebde..99e6da19 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -395,6 +395,7 @@ class BlockDevice: for partition in self: if partition.uuid == uuid: return partition + print('Returning False on get_partition()') class Partition: diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 9f4ddc6d..197666a4 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -701,7 +701,23 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict: 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 + # If we mark a partition for formatting, but the format is CRYPTO LUKS, there's no point in formatting it really + # without asking the user which inner-filesystem they want to use. Since the flag 'encrypted' = True is already set, + # it's safe to change the filesystem for this partition. + if block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('filesystem', {}).get('format', 'crypto_LUKS') == 'crypto_LUKS': + 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 + + # Negate the current wipe 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": -- cgit v1.2.3-54-g00ecf