mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 11:36:32 +01:00
Support interactive issue resolution prompts
This adds a new flag, -i / --interactive, which enables opening a Bash prompt whenever something goes wrong in the bootstrap. This is highly useful when developing or debugging live-bootstrap, but it needs to be off by default, for use in automated processes. In the future, asking for variables at runtime could (and perhaps should) also be gated behind this flag.
This commit is contained in:
parent
f9cf916e5e
commit
7851ab99cc
2 changed files with 21 additions and 7 deletions
|
|
@ -425,7 +425,17 @@ FILE *start_script(int id, int using_bash) {
|
|||
|
||||
if (using_bash) {
|
||||
fputs("#!/bin/bash\n", out);
|
||||
fputs("set -e\n", out);
|
||||
if (strcmp(get_var("INTERACTIVE"), "True") == 0) {
|
||||
if (using_bash != 1) {
|
||||
fputs("set -E\ntrap 'env PS1=\"[TRAP] \\w # \" bash -i' ERR\n", out);
|
||||
} else {
|
||||
fputs("set -E\ntrap 'bash -c '\"'\"'while true; do printf \""
|
||||
"[TRAP - use Ctrl+D] $(pwd) # \"; $(cat); done'\"'\"'' ERR\n",
|
||||
out);
|
||||
}
|
||||
} else {
|
||||
fputs("set -e\n", out);
|
||||
}
|
||||
fputs("cd /steps\n", out);
|
||||
fputs(". ./bootstrap.cfg\n", out);
|
||||
fputs(". ./env\n", out);
|
||||
|
|
@ -537,7 +547,7 @@ void generate(Directive *directives) {
|
|||
*/
|
||||
generate_preseed_jump(counter);
|
||||
}
|
||||
using_bash = 1;
|
||||
using_bash += 1;
|
||||
/* Create call to new script. */
|
||||
output_call_script(out, "", int2str(counter, 10, 0), using_bash, 0);
|
||||
fclose(out);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue