From 50ccaae76b98d50d663007023abf75c8a38f3d28 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Wed, 7 Jun 2023 22:44:49 +0200 Subject: [PATCH] pmb.config: select default UI in case current is not available For kernel selection we already choose a default like this, which makes sense since there's no point in having a preselected choice which doesn't exist (anymore). Also useful for some test suites where it runs "yes | pmbootstrap init" which would hang on this question. Reviewed-by: Oliver Smith Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230607204449.84020-2-luca@z3ntu.xyz%3E --- pmb/config/init.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pmb/config/init.py b/pmb/config/init.py index 37183c1f..face8e56 100644 --- a/pmb/config/init.py +++ b/pmb/config/init.py @@ -146,6 +146,11 @@ def ask_for_ui(args, info): ui_list.pop(i) hidden_ui_count += 1 + # Get default + default = args.ui + if default not in dict(ui_list).keys(): + default = pmb.config.defaults["ui"] + logging.info(f"Available user interfaces ({len(ui_list) - 1}): ") ui_completion_list = [] for ui in ui_list: @@ -158,7 +163,7 @@ def ask_for_ui(args, info): " available. See: