From d76760b45fcc085f1d878465e5293de2740a70b4 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 13 Jun 2021 14:25:07 +0200 Subject: Removed old safety logics for partitions. Partitions will now always be formatted when .format() is called on them. The safety now lay in the code parsing the declerative partition layouts. Also added the encrypt/mount logic for encrypted partitions, which by default will be unencrypted unless a password is specified. --- archinstall/lib/user_interaction.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 07f98328..da9f9809 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -9,7 +9,7 @@ import signal import sys import time -from .disk import BlockDevice, valid_fs_type, suggest_single_disk_layout, suggest_multi_disk_layout +from .disk import BlockDevice, valid_fs_type, find_partition_by_mountpoint, suggest_single_disk_layout, suggest_multi_disk_layout from .exceptions import * from .general import SysCommand from .hardware import AVAILABLE_GFX_DRIVERS, has_uefi @@ -190,18 +190,19 @@ def generic_multi_select(options, text="Select one or more of the options above sys.stdout.flush() return selected_options -def select_encrypted_partitions(blockdevices :dict) -> dict: - if len(blockdevices) == 1: - if len(blockdevices[0]['partitions']) == 2: - root = find_partition_by_mountpoint(blockdevices[0]['partitions'], '/') - blockdevices[0]['partitions'][root]['encrypted'] = True - return True +def select_encrypted_partitions(block_devices :dict, password :str) -> dict: + root = find_partition_by_mountpoint(block_devices, '/') + root['encrypted'] = True + root['password'] = password + + return block_devices - options = [] - for partition in blockdevices.values(): - options.append({key: val for key, val in partition.items() if val}) + # TODO: Next version perhaps we can support multiple encrypted partitions + #options = [] + #for partition in block_devices.values(): + # options.append({key: val for key, val in partition.items() if val}) - print(generic_multi_select(options, f"Choose which partitions to encrypt (leave blank when done): ")) + #print(generic_multi_select(options, f"Choose which partitions to encrypt (leave blank when done): ")) class MiniCurses: def __init__(self, width, height): -- cgit v1.2.3-70-g09d2