aboutsummaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init.c')
-rw-r--r--init.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/init.c b/init.c
index e70d5a15d..a3e8d6700 100644
--- a/init.c
+++ b/init.c
@@ -417,10 +417,14 @@ extern int init_main(int argc, char **argv)
417 pid_t pid1 = 0; 417 pid_t pid1 = 0;
418 pid_t pid2 = 0; 418 pid_t pid2 = 0;
419 struct stat statbuf; 419 struct stat statbuf;
420 const char* const init_commands[] = { INITSCRIPT, INITSCRIPT, 0}; 420 const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0};
421 const char* const shell_commands[] = { SHELL, "-" SHELL, 0}; 421 const char* const shell_command[] = { SHELL, "-" SHELL, 0};
422 const char* const* tty0_commands = shell_commands; 422 const char* const* tty0_command = shell_command;
423 const char* const* tty1_commands = shell_commands; 423 const char* const* tty1_command = shell_command;
424#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS
425 const char* const rc_exit_command[] = BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS;
426#endif
427
424#ifdef DEBUG_INIT 428#ifdef DEBUG_INIT
425 char *hello_msg_format = 429 char *hello_msg_format =
426 "init(%d) started: BusyBox v%s (%s) multi-call binary\r\n"; 430 "init(%d) started: BusyBox v%s (%s) multi-call binary\r\n";
@@ -493,7 +497,7 @@ extern int init_main(int argc, char **argv)
493 /* Make sure an init script exists before trying to run it */ 497 /* Make sure an init script exists before trying to run it */
494 if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) { 498 if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) {
495 wait_for_enter = FALSE; 499 wait_for_enter = FALSE;
496 tty0_commands = init_commands; 500 tty0_command = rc_script_command;
497 } 501 }
498 502
499 503
@@ -504,11 +508,11 @@ extern int init_main(int argc, char **argv)
504 pid_t wpid; 508 pid_t wpid;
505 int status; 509 int status;
506 510
507 if (pid1 == 0 && tty0_commands) { 511 if (pid1 == 0 && tty0_command) {
508 pid1 = run(tty0_commands, console, wait_for_enter); 512 pid1 = run(tty0_command, console, wait_for_enter);
509 } 513 }
510 if (pid2 == 0 && tty1_commands && second_console) { 514 if (pid2 == 0 && tty1_command && second_console) {
511 pid2 = run(tty1_commands, second_console, TRUE); 515 pid2 = run(tty1_command, second_console, TRUE);
512 } 516 }
513 wpid = wait(&status); 517 wpid = wait(&status);
514 if (wpid > 0 ) { 518 if (wpid > 0 ) {
@@ -518,13 +522,13 @@ extern int init_main(int argc, char **argv)
518 if (wpid == pid1) { 522 if (wpid == pid1) {
519 if (run_rc == FALSE) { 523 if (run_rc == FALSE) {
520 pid1 = 0; 524 pid1 = 0;
521 } 525 }
522#if 0 526#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS
523/* Turn this on to start a shell on the console if the init script exits.... */
524 else { 527 else {
528 pid1 = 0;
525 run_rc=FALSE; 529 run_rc=FALSE;
526 wait_for_enter=TRUE; 530 wait_for_enter=TRUE;
527 tty0_commands=shell_commands; 531 tty0_command=rc_exit_command;
528 } 532 }
529#endif 533#endif
530 } 534 }