Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDaniel <blackrabbit256@gmail.com>2021-12-03 07:17:51 +1100
committerGitHub <noreply@github.com>2021-12-02 21:17:51 +0100
commit908c7b8cc0a804e9522d93fcf0dc71034c53ccdb (patch)
tree6ca53ef0354481512920997a5e48e51b36d591f6 /examples
parent22ee2d90a1d2fb6af2ab5e80235e31f9da7a0550 (diff)
Add simple menu for better UX (#660)
* Add simple menu for better UX * Add remove external dependency * Fix harddisk return value on skip * Table output for partitioning process * Switch partitioning to simple menu * fixup! Switch partitioning to simple menu * Ignoring complexity and binary operator issues Only in simple_menu.py * Added license text to the MIT licensed file * Added in versioning information * Fixed some imports and removed the last generic_select() from user_interaction. Also fixed a revert/merged fork of ask_for_main_filesystem_format() * Update color scheme to match Arch style better * Use cyan as default cursor color * Leave simple menu the same Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton.feeds+github@gmail.com> Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/guided.py25
1 files changed, 7 insertions, 18 deletions
diff --git a/examples/guided.py b/examples/guided.py
index aabab3b5..2352b749 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -63,6 +63,7 @@ def load_config():
except:
raise ValueError("--disk_layouts=<json> needs either a JSON file or a JSON string given with a valid disk layout.")
+
def ask_user_questions():
"""
First, we'll ask the user for a bunch of user input.
@@ -70,12 +71,7 @@ def ask_user_questions():
will we continue with the actual installation steps.
"""
if not archinstall.arguments.get('keyboard-layout', None):
- while True:
- try:
- archinstall.arguments['keyboard-layout'] = archinstall.select_language(archinstall.list_keyboard_languages()).strip()
- break
- except archinstall.RequirementError as err:
- archinstall.log(err, fg="red")
+ archinstall.arguments['keyboard-layout'] = archinstall.select_language()
# Before continuing, set the preferred keyboard layout/language in the current terminal.
# This will just help the user with the next following questions.
@@ -84,12 +80,7 @@ def ask_user_questions():
# Set which region to download packages from during the installation
if not archinstall.arguments.get('mirror-region', None):
- while True:
- try:
- archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions(archinstall.list_mirrors())
- break
- except archinstall.RequirementError as e:
- archinstall.log(e, fg="red")
+ archinstall.arguments['mirror-region'] = archinstall.select_mirror_regions()
if not archinstall.arguments.get('sys-language', None) and archinstall.arguments.get('advanced', False):
archinstall.arguments['sys-language'] = input("Enter a valid locale (language) for your OS, (Default: en_US): ").strip()
@@ -104,9 +95,7 @@ def ask_user_questions():
# Ask which harddrives/block-devices we will install to
# and convert them into archinstall.BlockDevice() objects.
if archinstall.arguments.get('harddrives', None) is None:
- archinstall.arguments['harddrives'] = archinstall.generic_multi_select(archinstall.all_disks(),
- text="Select one or more harddrives to use and configure (leave blank to skip this step): ",
- allow_empty=True)
+ archinstall.arguments['harddrives'] = archinstall.select_harddrives()
if archinstall.arguments.get('harddrives', None) is not None and archinstall.storage.get('disk_layouts', None) is None:
archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives'], archinstall.arguments.get('advanced', False))
@@ -150,7 +139,8 @@ def ask_user_questions():
# Check the potentially selected profiles preparations to get early checks if some additional questions are needed.
if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function():
- with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
+ namespace = f"{archinstall.arguments['profile'].namespace}.py"
+ with archinstall.arguments['profile'].load_instructions(namespace=namespace) as imported:
if not imported._prep_function():
archinstall.log(' * Profile\'s preparation requirements was not fulfilled.', fg='red')
exit(1)
@@ -162,8 +152,7 @@ def ask_user_questions():
# Ask for preferred kernel:
if not archinstall.arguments.get("kernels", None):
- kernels = ["linux", "linux-lts", "linux-zen", "linux-hardened"]
- archinstall.arguments['kernels'] = archinstall.select_kernel(kernels)
+ archinstall.arguments['kernels'] = archinstall.select_kernel()
# Additional packages (with some light weight error handling for invalid package names)
print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.")