summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-05-26 16:08:19 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-05-26 16:08:19 +1000
commit80343e07470e28e30efa36c3a7fdb7b129117b34 (patch)
tree5dd674ead608912bb041b8fc663d8538626335aa
parent0ccde6508f7ba3c94caafd8ee013cbbf6bee4c2b (diff)
downloadpetitboot-80343e07470e28e30efa36c3a7fdb7b129117b34.zip
petitboot-80343e07470e28e30efa36c3a7fdb7b129117b34.tar.gz
ui/ncurses: Remember to abort boot on server connect
The UI can now come up before the server, but in order for a key press to cancel autoboot a key has to be pressed once the server connects. Instead remember to cancel autoboot if a key has been pressed at any point. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r--ui/ncurses/nc-cui.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index a2de48e..bd727a5 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -423,11 +423,16 @@ static int cui_process_key(void *arg)
if (c == ERR)
break;
- if (!cui->has_input && cui->client) {
- pb_log("UI input received (key = %d), aborting "
- "default boot\n", c);
- discover_client_cancel_default(cui->client);
+ if (!cui->has_input) {
cui->has_input = true;
+ if (cui->client) {
+ pb_log("UI input received (key = %d), aborting "
+ "default boot\n", c);
+ discover_client_cancel_default(cui->client);
+ } else {
+ pb_log("UI input received (key = %d), aborting "
+ "once server connects\n", c);
+ }
}
if (process_global_keys(cui, c))
@@ -927,6 +932,11 @@ static int cui_server_wait(void *arg)
} else {
nc_scr_status_printf(cui->current, "Info: Connected to server!");
talloc_steal(cui, cui->client);
+
+ if (cui->has_input) {
+ pb_log("Aborting default boot on server connect\n");
+ discover_client_cancel_default(cui->client);
+ }
}
return 0;
OpenPOWER on IntegriCloud