DEFINE_HOST_PROG(VGCHANGE, vgchange, [/usr/sbin/vgchange])
DEFINE_HOST_PROG(PB_PLUGIN, pb-plugin, [/usr/sbin/pb-plugin])
DEFINE_HOST_PROG(PB_EXEC, pb-exec, [/usr/sbin/pb-exec])
+DEFINE_HOST_PROG(SH, sh, [/bin/sh])
AC_ARG_WITH(
[tftp],
.vgchange = HOST_PROG_VGCHANGE,
.pb_plugin = HOST_PROG_PB_PLUGIN,
.pb_exec = HOST_PROG_PB_EXEC,
+ .sh = HOST_PROG_SH,
};
#ifndef TFTP_TYPE
void cui_on_exit(struct pmenu *menu)
{
- cui_abort(cui_from_pmenu(menu));
+ struct cui *cui = cui_from_pmenu(menu);
+ char *sh_cmd;
+
+ sh_cmd = talloc_asprintf(cui,
+ "echo \"Exiting petitboot. Type 'exit' to return.\";\
+ echo \"You may run 'pb-sos' to gather diagnostic data\";\
+ %s", pb_system_apps.sh);
+
+ if (!sh_cmd) {
+ pb_log("Failed to allocate shell arguments\n");
+ return;
+ }
+
+ const char *argv[] = {
+ pb_system_apps.sh,
+ "-c",
+ sh_cmd,
+ NULL
+ };
+
+ cui_run_cmd(cui, argv);
+
+ nc_scr_status_printf(cui->current, _("Returned from shell"));
+ talloc_free(sh_cmd);
}
/**
nc_scr_status_printf(cui->current, _("Running %s..."), cmd_argv[0]);
+ nc_scr_unpost(cui->current);
+ clear();
+ refresh();
+
def_prog_mode();
endwin();
refresh();
redrawwin(cui->current->main_ncw);
+ nc_scr_post(cui->current);
if (result) {
pb_log("%s: failed: '%s'\n", __func__, cmd_argv[0]);