Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-11-11 19:40:05 +1100
committerGitHub <noreply@github.com>2022-11-11 09:40:05 +0100
commitc3862c5779194f5e93f9fd2518bb15706c93ad2b (patch)
treed369d5c9dbec14432e3ed42bf872f4b4e021278c /archinstall/lib/user_interaction
parentee1eea21307586c749c2734cff6440ff8f1c2806 (diff)
New encryption menu (#1520)
* New encryption menu Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib/user_interaction')
-rw-r--r--archinstall/lib/user_interaction/__init__.py2
-rw-r--r--archinstall/lib/user_interaction/disk_conf.py10
-rw-r--r--archinstall/lib/user_interaction/general_conf.py26
-rw-r--r--archinstall/lib/user_interaction/locale_conf.py4
-rw-r--r--archinstall/lib/user_interaction/network_conf.py10
-rw-r--r--archinstall/lib/user_interaction/partitioning_conf.py42
-rw-r--r--archinstall/lib/user_interaction/save_conf.py2
-rw-r--r--archinstall/lib/user_interaction/system_conf.py22
8 files changed, 40 insertions, 78 deletions
diff --git a/archinstall/lib/user_interaction/__init__.py b/archinstall/lib/user_interaction/__init__.py
index a1ca2652..2bc46759 100644
--- a/archinstall/lib/user_interaction/__init__.py
+++ b/archinstall/lib/user_interaction/__init__.py
@@ -4,7 +4,7 @@ from .backwards_compatible_conf import generic_select, generic_multi_select
from .locale_conf import select_locale_lang, select_locale_enc
from .system_conf import select_kernel, select_harddrives, select_driver, ask_for_bootloader, ask_for_swap
from .network_conf import ask_to_configure_network
-from .partitioning_conf import select_partition, select_encrypted_partitions
+from .partitioning_conf import select_partition
from .general_conf import (ask_ntp, ask_for_a_timezone, ask_for_audio_selection, select_language, select_mirror_regions,
select_profile, select_archinstall_language, ask_additional_packages_to_install,
select_additional_repositories, ask_hostname, add_number_of_parrallel_downloads)
diff --git a/archinstall/lib/user_interaction/disk_conf.py b/archinstall/lib/user_interaction/disk_conf.py
index b5ed6967..554d13ef 100644
--- a/archinstall/lib/user_interaction/disk_conf.py
+++ b/archinstall/lib/user_interaction/disk_conf.py
@@ -45,13 +45,13 @@ def select_disk_layout(preset: Optional[Dict[str, Any]], block_devices: list, ad
choice = Menu(
_('Select what you wish to do with the selected block devices'),
modes,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return None
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return None
case MenuSelectionType.Selection:
if choice.value == wipe_mode:
return get_default_partition_layout(block_devices, advanced_options)
@@ -77,7 +77,7 @@ def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> Optional[BlockDevice]:
choice = Menu(title, drives).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return None
drive = dict_o_disks[choice.value]
diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py
index efd746a4..76631a98 100644
--- a/archinstall/lib/user_interaction/general_conf.py
+++ b/archinstall/lib/user_interaction/general_conf.py
@@ -48,7 +48,7 @@ def ask_for_a_timezone(preset: str = None) -> str:
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return choice.value
@@ -60,7 +60,7 @@ def ask_for_audio_selection(desktop: bool = True, preset: str = None) -> str:
choice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return choice.value
@@ -107,12 +107,12 @@ def select_mirror_regions(preset_values: Dict[str, Any] = {}) -> Dict[str, Any]:
list(mirrors.keys()),
preset_values=preselected,
multi=True,
- raise_error_on_interrupt=True
+ allow_reset=True
).run()
match selected_mirror.type_:
- case MenuSelectionType.Ctrl_c: return {}
- case MenuSelectionType.Esc: return preset_values
+ case MenuSelectionType.Reset: return {}
+ case MenuSelectionType.Skip: return preset_values
case _: return {selected: mirrors[selected] for selected in selected_mirror.value}
@@ -134,7 +134,7 @@ def select_archinstall_language(languages: List[Language], preset_value: Languag
).run()
match choice.type_:
- case MenuSelectionType.Esc:
+ case MenuSelectionType.Skip:
return preset_value
case MenuSelectionType.Selection:
return options[choice.value]
@@ -163,21 +163,21 @@ def select_profile(preset) -> Optional[Profile]:
selection = Menu(
title=title,
p_options=list(options.keys()),
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match selection.type_:
case MenuSelectionType.Selection:
return options[selection.value] if selection.value is not None else None
- case MenuSelectionType.Ctrl_c:
+ case MenuSelectionType.Reset:
storage['profile_minimal'] = False
storage['_selected_servers'] = []
storage['_desktop_profile'] = None
storage['arguments']['desktop-environment'] = None
storage['arguments']['gfx_driver_packages'] = None
return None
- case MenuSelectionType.Esc:
+ case MenuSelectionType.Skip:
return None
@@ -259,10 +259,10 @@ def select_additional_repositories(preset: List[str]) -> List[str]:
sort=False,
multi=True,
preset_values=preset,
- raise_error_on_interrupt=True
+ allow_reset=True
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return []
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return []
case MenuSelectionType.Selection: return choice.value
diff --git a/archinstall/lib/user_interaction/locale_conf.py b/archinstall/lib/user_interaction/locale_conf.py
index 15720064..bbbe070b 100644
--- a/archinstall/lib/user_interaction/locale_conf.py
+++ b/archinstall/lib/user_interaction/locale_conf.py
@@ -23,7 +23,7 @@ def select_locale_lang(preset: str = None) -> str:
match selected_locale.type_:
case MenuSelectionType.Selection: return selected_locale.value
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
def select_locale_enc(preset: str = None) -> str:
@@ -39,4 +39,4 @@ def select_locale_enc(preset: str = None) -> str:
match selected_locale.type_:
case MenuSelectionType.Selection: return selected_locale.value
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
diff --git a/archinstall/lib/user_interaction/network_conf.py b/archinstall/lib/user_interaction/network_conf.py
index 557e8ed8..5e637f23 100644
--- a/archinstall/lib/user_interaction/network_conf.py
+++ b/archinstall/lib/user_interaction/network_conf.py
@@ -71,7 +71,7 @@ class ManualNetworkConfig(ListManager):
available = set(all_ifaces) - set(existing_ifaces)
choice = Menu(str(_('Select interface to add')), list(available), skip=True).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return None
return choice.value
@@ -154,13 +154,13 @@ def ask_to_configure_network(
list(network_options.values()),
cursor_index=cursor_idx,
sort=False,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return None
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return None
if choice.value == network_options['none']:
return None
diff --git a/archinstall/lib/user_interaction/partitioning_conf.py b/archinstall/lib/user_interaction/partitioning_conf.py
index f2e6b881..cff76dc2 100644
--- a/archinstall/lib/user_interaction/partitioning_conf.py
+++ b/archinstall/lib/user_interaction/partitioning_conf.py
@@ -119,7 +119,7 @@ def select_partition(
choice = Menu(title, partition_indexes, multi=multiple).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return None
if isinstance(choice.value, list):
@@ -150,7 +150,6 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
delete_all_partitions = str(_('Clear/Delete all partitions'))
assign_mount_point = str(_('Assign mount-point for a partition'))
mark_formatted = str(_('Mark/Unmark a partition to be formatted (wipes data)'))
- mark_encrypted = str(_('Mark/Unmark a partition as encrypted'))
mark_compressed = str(_('Mark/Unmark a partition as compressed (btrfs only)'))
mark_bootable = str(_('Mark/Unmark a partition as bootable (automatic for /boot)'))
set_filesystem_partition = str(_('Set desired filesystem for a partition'))
@@ -167,7 +166,6 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
delete_all_partitions,
assign_mount_point,
mark_formatted,
- mark_encrypted,
mark_bootable,
mark_compressed,
set_filesystem_partition,
@@ -207,7 +205,7 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
fs_choice = Menu(_('Enter a desired filesystem type for the partition'), fs_types()).run()
- if fs_choice.type_ == MenuSelectionType.Esc:
+ if fs_choice.type_ == MenuSelectionType.Skip:
continue
prompt = str(_('Enter the start sector (percentage or block number, default: {}): ')).format(
@@ -322,15 +320,6 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
# Negate the current wipe marking
block_device_struct["partitions"][partition]['wipe'] = not block_device_struct["partitions"][partition].get('wipe', False)
- elif task == mark_encrypted:
- title = _('{}\n\nSelect which partition to mark as encrypted').format(current_layout)
- partition = select_partition(title, block_device_struct["partitions"])
-
- if partition is not None:
- # Negate the current encryption marking
- block_device_struct["partitions"][partition]['encrypted'] = \
- not block_device_struct["partitions"][partition].get('encrypted', False)
-
elif task == mark_bootable:
title = _('{}\n\nSelect which partition to mark as bootable').format(current_layout)
partition = select_partition(title, block_device_struct["partitions"])
@@ -371,30 +360,3 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
block_device_struct["partitions"][partition]['btrfs']['subvolumes'] = result
return block_device_struct
-
-
-def select_encrypted_partitions(
- title :str,
- partitions :List[Partition],
- multiple :bool = True,
- filter_ :Callable = None
-) -> Optional[int, List[int]]:
- partition_indexes = _get_partitions(partitions, filter_)
-
- if len(partition_indexes) == 0:
- return None
-
- # show current partition layout:
- if len(partitions):
- title += current_partition_layout(partitions, with_idx=True) + '\n'
-
- choice = Menu(title, partition_indexes, multi=multiple).run()
-
- if choice.type_ == MenuSelectionType.Esc:
- return None
-
- if isinstance(choice.value, list):
- for partition_index in choice.value:
- yield int(partition_index)
- else:
- yield (partition_index)
diff --git a/archinstall/lib/user_interaction/save_conf.py b/archinstall/lib/user_interaction/save_conf.py
index f542bc9b..d60ef995 100644
--- a/archinstall/lib/user_interaction/save_conf.py
+++ b/archinstall/lib/user_interaction/save_conf.py
@@ -55,7 +55,7 @@ def save_config(config: Dict):
preview_command=preview
).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return
while True:
diff --git a/archinstall/lib/user_interaction/system_conf.py b/archinstall/lib/user_interaction/system_conf.py
index 8b574b2c..42a6cec7 100644
--- a/archinstall/lib/user_interaction/system_conf.py
+++ b/archinstall/lib/user_interaction/system_conf.py
@@ -32,13 +32,13 @@ def select_kernel(preset: List[str] = None) -> List[str]:
sort=True,
multi=True,
preset_values=preset,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return []
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return []
case MenuSelectionType.Selection: return choice.value
@@ -62,13 +62,13 @@ def select_harddrives(preset: List[str] = []) -> List[str]:
list(options.keys()),
preset_values=preset,
multi=True,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match selected_harddrive.type_:
- case MenuSelectionType.Ctrl_c: return []
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Reset: return []
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return [options[i] for i in selected_harddrive.value]
@@ -132,7 +132,7 @@ def ask_for_bootloader(advanced_options: bool = False, preset: str = None) -> st
).run()
match selection.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: bootloader = 'grub-install' if selection.value == Menu.yes() else bootloader
else:
# We use the common names for the bootloader as the selection, and map it back to the expected values.
@@ -141,7 +141,7 @@ def ask_for_bootloader(advanced_options: bool = False, preset: str = None) -> st
value = ''
match selection.type_:
- case MenuSelectionType.Esc: value = preset_val
+ case MenuSelectionType.Skip: value = preset_val
case MenuSelectionType.Selection: value = selection.value
if value != "":
@@ -165,5 +165,5 @@ def ask_for_swap(preset: bool = True) -> bool:
choice = Menu(prompt, Menu.yes_no(), default_option=Menu.yes(), preset_values=preset_val).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return False if choice.value == Menu.no() else True