core: add 'c' in confirmation_spawn to resume the boot process
This commit is contained in:
parent
56fde33af1
commit
b0eb29449e
1
NEWS
1
NEWS
|
@ -5,6 +5,7 @@ CHANGES WITH 233 in spe
|
||||||
* The confirmation spawn prompt has been reworked to offer the
|
* The confirmation spawn prompt has been reworked to offer the
|
||||||
following choices:
|
following choices:
|
||||||
|
|
||||||
|
(c)ontinue, proceed without asking anymore
|
||||||
(D)ump, show the state of the unit
|
(D)ump, show the state of the unit
|
||||||
(f)ail, don't execute the command and pretend it failed
|
(f)ail, don't execute the command and pretend it failed
|
||||||
(h)elp
|
(h)elp
|
||||||
|
|
|
@ -732,6 +732,12 @@ static int ask_for_confirmation(const char *vc, Unit *u, const char *cmdline) {
|
||||||
return CONFIRM_EXECUTE;
|
return CONFIRM_EXECUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* confirm_spawn might have been disabled while we were sleeping. */
|
||||||
|
if (manager_is_confirm_spawn_disabled(u->manager)) {
|
||||||
|
r = 1;
|
||||||
|
goto restore_stdio;
|
||||||
|
}
|
||||||
|
|
||||||
e = ellipsize(cmdline, 60, 100);
|
e = ellipsize(cmdline, 60, 100);
|
||||||
if (!e) {
|
if (!e) {
|
||||||
log_oom();
|
log_oom();
|
||||||
|
@ -740,7 +746,7 @@ static int ask_for_confirmation(const char *vc, Unit *u, const char *cmdline) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
r = ask_char(&c, "yfshiDj", "Execute %s? [y, f, s – h for help] ", e);
|
r = ask_char(&c, "yfshiDjc", "Execute %s? [y, f, s – h for help] ", e);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
write_confirm_error_fd(r, STDOUT_FILENO);
|
write_confirm_error_fd(r, STDOUT_FILENO);
|
||||||
r = CONFIRM_EXECUTE;
|
r = CONFIRM_EXECUTE;
|
||||||
|
@ -748,6 +754,11 @@ static int ask_for_confirmation(const char *vc, Unit *u, const char *cmdline) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case 'c':
|
||||||
|
printf("Resuming normal execution.\n");
|
||||||
|
manager_disable_confirm_spawn();
|
||||||
|
r = 1;
|
||||||
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
unit_dump(u, stdout, " ");
|
unit_dump(u, stdout, " ");
|
||||||
continue; /* ask again */
|
continue; /* ask again */
|
||||||
|
@ -756,7 +767,8 @@ static int ask_for_confirmation(const char *vc, Unit *u, const char *cmdline) {
|
||||||
r = CONFIRM_PRETEND_FAILURE;
|
r = CONFIRM_PRETEND_FAILURE;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
printf(" D - dump, show the state of the unit\n"
|
printf(" c - continue, proceed without asking anymore\n"
|
||||||
|
" D - dump, show the state of the unit\n"
|
||||||
" f - fail, don't execute the command and pretend it failed\n"
|
" f - fail, don't execute the command and pretend it failed\n"
|
||||||
" h - help\n"
|
" h - help\n"
|
||||||
" i - info, show a short summary of the unit\n"
|
" i - info, show a short summary of the unit\n"
|
||||||
|
@ -2373,7 +2385,7 @@ static int exec_child(
|
||||||
|
|
||||||
exec_context_tty_reset(context, params);
|
exec_context_tty_reset(context, params);
|
||||||
|
|
||||||
if (params->confirm_spawn) {
|
if (!manager_is_confirm_spawn_disabled(unit->manager)) {
|
||||||
const char *vc = params->confirm_spawn;
|
const char *vc = params->confirm_spawn;
|
||||||
_cleanup_free_ char *cmdline = NULL;
|
_cleanup_free_ char *cmdline = NULL;
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void manager_watch_jobs_in_progress(Manager *m) {
|
||||||
/* We do not want to show the cylon animation if the user
|
/* We do not want to show the cylon animation if the user
|
||||||
* needs to confirm service executions otherwise confirmation
|
* needs to confirm service executions otherwise confirmation
|
||||||
* messages will be screwed by the cylon animation. */
|
* messages will be screwed by the cylon animation. */
|
||||||
if (m->confirm_spawn)
|
if (!manager_is_confirm_spawn_disabled(m))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m->jobs_in_progress_event_source)
|
if (m->jobs_in_progress_event_source)
|
||||||
|
@ -3218,6 +3218,17 @@ void manager_set_first_boot(Manager *m, bool b) {
|
||||||
m->first_boot = b;
|
m->first_boot = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void manager_disable_confirm_spawn(void) {
|
||||||
|
(void) touch("/run/systemd/confirm_spawn_disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool manager_is_confirm_spawn_disabled(Manager *m) {
|
||||||
|
if (!m->confirm_spawn)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return access("/run/systemd/confirm_spawn_disabled", F_OK) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
void manager_status_printf(Manager *m, StatusType type, const char *status, const char *format, ...) {
|
void manager_status_printf(Manager *m, StatusType type, const char *status, const char *format, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
|
|
@ -405,3 +405,5 @@ const char *manager_state_to_string(ManagerState m) _const_;
|
||||||
ManagerState manager_state_from_string(const char *s) _pure_;
|
ManagerState manager_state_from_string(const char *s) _pure_;
|
||||||
|
|
||||||
const char *manager_get_confirm_spawn(Manager *m);
|
const char *manager_get_confirm_spawn(Manager *m);
|
||||||
|
bool manager_is_confirm_spawn_disabled(Manager *m);
|
||||||
|
void manager_disable_confirm_spawn(void);
|
||||||
|
|
Loading…
Reference in a new issue