]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysinstall: suppress 'no' prompt to begin installation
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 16 Jul 2026 17:03:18 +0000 (19:03 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Fri, 17 Jul 2026 07:15:09 +0000 (09:15 +0200)
The user has to type 'yes', but it doesn't mean that the default of
'no' is ever useful. Suppress it, so the user doesn't have to press
backspace twice.

src/cryptenroll/cryptenroll-interactive.c
src/shared/prompt-util.c
src/shared/prompt-util.h
src/sysinstall/sysinstall.c

index c4b8c998bf55c082ee0dc9fc8d7b99f04d04965a..f0c1e83789fbc21af4e030f5ea2d7f9ff4f785f8 100644 (file)
@@ -151,7 +151,7 @@ static int ask_wipe(EnrollContext *c, unsigned existing_mask) {
                         return log_oom();
 
                 bool wipe;
-                r = prompt_loop_yes_no(question, /* def= */ false, &wipe);
+                r = prompt_loop_yes_no(question, "no", /* def= */ false, &wipe);
                 if (r < 0)
                         return r;
 
index a7bcfe32e332cce014de701a274503c00df707dd..0a5ab0291b747b51a0178d13b7fbea27e291292b 100644 (file)
@@ -217,19 +217,19 @@ static int boolean_is_valid(const char *name, void *userdata) {
         return parse_boolean(name) >= 0;
 }
 
-int prompt_loop_yes_no(const char *question, bool def, bool *ret) {
+int prompt_loop_yes_no(const char *question, const char *prefill, bool def, bool *ret) {
         int r;
 
         assert(question);
         assert(ret);
 
-        char **l = STRV_MAKE("yes", "no");
+        char **menu = STRV_MAKE("yes", "no");
 
         _cleanup_free_ char *reply = NULL;
         r = prompt_loop(question,
                         GLYPH_WARNING_SIGN,
-                        /* prefill= */ def ? "yes" : "no",
-                        /* menu= */ l,
+                        /* prefill= */ prefill,
+                        /* menu= */ menu,
                         /* accepted= */ NULL,
                         /* ellipsize_percentage= */ 20,
                         /* n_columns= */ 2,
index 19ab497f0839cf9b41951a73c6e956667cac8d6b..7c35cb5e58277980990ea4b7fb5bc7e7b2df095c 100644 (file)
@@ -26,7 +26,7 @@ int prompt_loop(const char *text,
                 PromptFlags flags,
                 char **ret);
 
-int prompt_loop_yes_no(const char *question, bool def, bool *ret);
+int prompt_loop_yes_no(const char *question, const char *prefill, bool def, bool *ret);
 
 int chrome_show(const char *top, const char *bottom);
 void chrome_hide(void);
index 82232f8ccb7a1cc3505e36371dd1b2380a8a5def..7a531edfcc3b93b06f1fd27bf20db90174030746 100644 (file)
@@ -903,6 +903,7 @@ static int prompt_confirm(void) {
         bool yes;
         r = prompt_loop_yes_no(arg_summary ? "Please type 'yes' to confirm the choices above and begin the installation" :
                                              "Please type 'yes' to begin the installation",
+                               /* prefill= */ NULL,
                                /* def= */ false,
                                &yes);
         if (r < 0)