* The confirmation spawn prompt has been reworked to offer the
following choices:
+ (c)ontinue, proceed without asking anymore
(D)ump, show the state of the unit
(f)ail, don't execute the command and pretend it failed
(h)elp
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);
if (!e) {
log_oom();
}
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) {
write_confirm_error_fd(r, STDOUT_FILENO);
r = CONFIRM_EXECUTE;
}
switch (c) {
+ case 'c':
+ printf("Resuming normal execution.\n");
+ manager_disable_confirm_spawn();
+ r = 1;
+ break;
case 'D':
unit_dump(u, stdout, " ");
continue; /* ask again */
r = CONFIRM_PRETEND_FAILURE;
break;
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"
" h - help\n"
" i - info, show a short summary of the unit\n"
exec_context_tty_reset(context, params);
- if (params->confirm_spawn) {
+ if (!manager_is_confirm_spawn_disabled(unit->manager)) {
const char *vc = params->confirm_spawn;
_cleanup_free_ char *cmdline = NULL;
/* We do not want to show the cylon animation if the user
* needs to confirm service executions otherwise confirmation
* messages will be screwed by the cylon animation. */
- if (m->confirm_spawn)
+ if (!manager_is_confirm_spawn_disabled(m))
return;
if (m->jobs_in_progress_event_source)
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, ...) {
va_list ap;