aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-12-07 08:37:31 +0000
committerEric Andersen <andersen@codepoet.org>1999-12-07 08:37:31 +0000
commitd00c2628474b9e6a3fe34c988fe197cf2425ff1a (patch)
tree960ee0d6353cfae1ff21820f8a2d95f6c2ed08c9
parent0ecb54a0f3fece5e42f089036f059973bed8d87e (diff)
downloadbusybox-w32-d00c2628474b9e6a3fe34c988fe197cf2425ff1a.tar.gz
busybox-w32-d00c2628474b9e6a3fe34c988fe197cf2425ff1a.tar.bz2
busybox-w32-d00c2628474b9e6a3fe34c988fe197cf2425ff1a.zip
Stuf
-rw-r--r--Changelog11
-rw-r--r--Makefile4
-rwxr-xr-xapplets/install.sh3
-rw-r--r--busybox.def.h2
-rw-r--r--init.c74
-rw-r--r--init/init.c74
-rwxr-xr-xinstall.sh3
-rw-r--r--umount.c6
-rw-r--r--util-linux/umount.c6
9 files changed, 126 insertions, 57 deletions
diff --git a/Changelog b/Changelog
index 668695f3c..9698396e0 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,7 @@
10.38 10.38
2 * Fixed a segfault in 'umount -a' when a badly formed /etc/fstab 2 * Fixed a segfault in 'umount -a' when a badly formed /etc/fstab
3 file existed. 3 file existed.
4 * df will not exit on error, but will try to stat all mounted filesystems. 4 * df will not exit on error, but will stat all mounted filesystems.
5 * Fixed tar so uid/gid/permissions on extracted tarballs will be correct. 5 * Fixed tar so uid/gid/permissions on extracted tarballs will be correct.
6 * Fixed find -name so it properly uses shell wildcard patterns 6 * Fixed find -name so it properly uses shell wildcard patterns
7 (i.e. `*', `?', and `[]') instead of regular expressions, which 7 (i.e. `*', `?', and `[]') instead of regular expressions, which
@@ -10,11 +10,12 @@
10 kernel messages. 10 kernel messages.
11 * syslogd now creates the /dev/log socket to make sure it is there, and 11 * syslogd now creates the /dev/log socket to make sure it is there, and
12 is actually a socket with the right permissions. 12 is actually a socket with the right permissions.
13 * I've taken a first step to making busybox not need the /proc filesystem. 13 * I've taken a first step to making busybox not need the /proc
14 Most apps don't need it. Those that _require_ it, will complain 14 filesystem. Most apps don't need it. Those that _require_ it,
15 if you enable them when you disable BB_FEATURE_USE_PROCFS. 15 will complain if you enable them when you disable
16 BB_FEATURE_USE_PROCFS.
16 17
17 -Erik Andrsen 18 -Erik Andrsen, Dec 5, 1999
18 19
190.37 200.37
20 * Wrote a micro syslogd, and a logger util (to log things to the syslog 21 * Wrote a micro syslogd, and a logger util (to log things to the syslog
diff --git a/Makefile b/Makefile
index 4b174c313..1168e9daa 100644
--- a/Makefile
+++ b/Makefile
@@ -73,7 +73,7 @@ else
73endif 73endif
74 74
75ifndef $(PREFIX) 75ifndef $(PREFIX)
76 PREFIX=`pwd`/busybox_install 76 PREFIX=`pwd`/_install
77endif 77endif
78 78
79LIBRARIES= 79LIBRARIES=
@@ -95,7 +95,7 @@ busybox.links:
95 95
96clean: 96clean:
97 - rm -f $(PROG) busybox.links *~ *.o core 97 - rm -f $(PROG) busybox.links *~ *.o core
98 - rm -rf busybox_install 98 - rm -rf _install
99 99
100distclean: clean 100distclean: clean
101 - rm -f $(PROG) 101 - rm -f $(PROG)
diff --git a/applets/install.sh b/applets/install.sh
index 670c0c6e1..769d1f4a3 100755
--- a/applets/install.sh
+++ b/applets/install.sh
@@ -12,8 +12,7 @@ h=`sort busybox.links | uniq`
12for i in $h ; do 12for i in $h ; do
13 echo " $1$i -> /bin/busybox" 13 echo " $1$i -> /bin/busybox"
14 mkdir -p $1/`echo $i | sed -e 's/\/[^\/]*$//' ` 14 mkdir -p $1/`echo $i | sed -e 's/\/[^\/]*$//' `
15 rm -f $1$i 15 ln -fs /bin/busybox $1$i
16 ln -s /bin/busybox $1$i
17done 16done
18rm -f $1/bin/busybox 17rm -f $1/bin/busybox
19install -m 755 busybox $1/bin/busybox 18install -m 755 busybox $1/bin/busybox
diff --git a/busybox.def.h b/busybox.def.h
index a1f55ffe6..3284a63d3 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -74,6 +74,8 @@
74// pretty/useful). 74// pretty/useful).
75// 75//
76// 76//
77// enable a second console on VT2 in init
78#define BB_FEATURE_INIT_SECOND_CONSOLE
77// enable features that use the /proc filesystem 79// enable features that use the /proc filesystem
78#define BB_FEATURE_USE_PROCFS 80#define BB_FEATURE_USE_PROCFS
79//Enable init being called as /linuxrc 81//Enable init being called as /linuxrc
diff --git a/init.c b/init.c
index 84b558d84..dbd9f2812 100644
--- a/init.c
+++ b/init.c
@@ -55,6 +55,7 @@
55#define VT_LOG "/dev/tty3" /* Virtual console */ 55#define VT_LOG "/dev/tty3" /* Virtual console */
56#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ 56#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
57#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ 57#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
58#define GETTY "/sbin/getty" /* Default location of getty */
58#define SHELL "/bin/sh" /* Default shell */ 59#define SHELL "/bin/sh" /* Default shell */
59#define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */ 60#define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */
60 61
@@ -446,15 +447,19 @@ static void reboot_signal(int sig)
446 447
447extern int init_main(int argc, char **argv) 448extern int init_main(int argc, char **argv)
448{ 449{
449 int run_rc = TRUE; 450 int run_rc = FALSE;
450 int wait_for_enter = TRUE; 451 int single = FALSE;
452 int wait_for_enter_tty1 = TRUE;
453 int wait_for_enter_tty2 = TRUE;
451 pid_t pid1 = 0; 454 pid_t pid1 = 0;
452 pid_t pid2 = 0; 455 pid_t pid2 = 0;
453 struct stat statbuf; 456 struct stat statbuf;
454 const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0}; 457 const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0};
458 const char* const getty1_command[] = { GETTY, GETTY, VT_PRIMARY, 0};
459 const char* const getty2_command[] = { GETTY, GETTY, VT_SECONDARY, 0};
455 const char* const shell_command[] = { SHELL, "-" SHELL, 0}; 460 const char* const shell_command[] = { SHELL, "-" SHELL, 0};
456 const char* const* tty0_command = shell_command;
457 const char* const* tty1_command = shell_command; 461 const char* const* tty1_command = shell_command;
462 const char* const* tty2_command = shell_command;
458#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS 463#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS
459 const char* const rc_exit_command[] = { "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 464 const char* const rc_exit_command[] = { "BB_INIT_CMD_IF_RC_SCRIPT_EXITS",
460 "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 0 }; 465 "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 0 };
@@ -477,13 +482,6 @@ extern int init_main(int argc, char **argv)
477 } 482 }
478#endif 483#endif
479 484
480 /* Check if we are supposed to be in single user mode */
481 if ( argc > 1 && (!strcmp(argv[1], "single") ||
482 !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) {
483 run_rc = FALSE;
484 }
485
486
487 /* Set up sig handlers -- be sure to 485 /* Set up sig handlers -- be sure to
488 * clear all of these in run() */ 486 * clear all of these in run() */
489 signal(SIGUSR1, halt_signal); 487 signal(SIGUSR1, halt_signal);
@@ -529,27 +527,55 @@ extern int init_main(int argc, char **argv)
529 /* Make sure there is enough memory to do something useful. */ 527 /* Make sure there is enough memory to do something useful. */
530 check_memory(); 528 check_memory();
531 529
530 /* Check if we are supposed to be in single user mode */
531 if ( argc > 1 && (!strcmp(argv[1], "single") ||
532 !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) {
533 single = TRUE;
534 tty1_command = shell_command;
535 tty2_command = shell_command;
536 }
532 537
533 /* Make sure an init script exists before trying to run it */ 538 /* Make sure an init script exists before trying to run it */
534 if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) { 539 if (single==FALSE && stat(INITSCRIPT, &statbuf)==0) {
535 wait_for_enter = FALSE; 540 run_rc = TRUE;
536 tty0_command = rc_script_command; 541 wait_for_enter_tty1 = FALSE;
542 tty1_command = rc_script_command;
537 } 543 }
544
545 /* Make sure /sbin/getty exists before trying to run it */
546 if (stat(GETTY, &statbuf)==0) {
547 char* where;
548 wait_for_enter_tty2 = FALSE;
549 where = strrchr( console, '/');
550 if ( where != NULL) {
551 strcpy( (char*)getty2_command[2], where);
552 }
553 tty2_command = getty2_command;
554 /* Check on hooking a getty onto tty1 */
555 if (run_rc == FALSE && single==FALSE) {
556 wait_for_enter_tty1 = FALSE;
557 where = strrchr( second_console, '/');
558 if ( where != NULL) {
559 strcpy( (char*)getty1_command[2], where);
560 }
561 tty1_command = getty1_command;
562 }
563 }
564
538 565
539 566 /* Ok, now launch the tty1_command and tty2_command */
540 /* Ok, now launch the rc script and/or prepare to
541 * start up some VTs if somebody hits enter...
542 */
543 for (;;) { 567 for (;;) {
544 pid_t wpid; 568 pid_t wpid;
545 int status; 569 int status;
546 570
547 if (pid1 == 0 && tty0_command) { 571 if (pid1 == 0 && tty1_command) {
548 pid1 = run(tty0_command, console, wait_for_enter); 572 pid1 = run(tty1_command, console, wait_for_enter_tty1);
549 } 573 }
550 if (pid2 == 0 && tty1_command && second_console) { 574#ifdef BB_FEATURE_INIT_SECOND_CONSOLE
551 pid2 = run(tty1_command, second_console, TRUE); 575 if (pid2 == 0 && tty2_command && second_console) {
576 pid2 = run(tty2_command, second_console, wait_for_enter_tty2);
552 } 577 }
578#endif
553 wpid = wait(&status); 579 wpid = wait(&status);
554 if (wpid > 0 ) { 580 if (wpid > 0 ) {
555 message(LOG, "pid %d exited, status=%x.\n", wpid, status); 581 message(LOG, "pid %d exited, status=%x.\n", wpid, status);
@@ -563,14 +589,16 @@ extern int init_main(int argc, char **argv)
563 else { 589 else {
564 pid1 = 0; 590 pid1 = 0;
565 run_rc=FALSE; 591 run_rc=FALSE;
566 wait_for_enter=TRUE; 592 wait_for_enter_tty1=TRUE;
567 tty0_command=rc_exit_command; 593 tty1_command=rc_exit_command;
568 } 594 }
569#endif 595#endif
570 } 596 }
597#ifdef BB_FEATURE_INIT_SECOND_CONSOLE
571 if (wpid == pid2) { 598 if (wpid == pid2) {
572 pid2 = 0; 599 pid2 = 0;
573 } 600 }
601#endif
574 sleep(1); 602 sleep(1);
575 } 603 }
576} 604}
diff --git a/init/init.c b/init/init.c
index 84b558d84..dbd9f2812 100644
--- a/init/init.c
+++ b/init/init.c
@@ -55,6 +55,7 @@
55#define VT_LOG "/dev/tty3" /* Virtual console */ 55#define VT_LOG "/dev/tty3" /* Virtual console */
56#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ 56#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
57#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ 57#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
58#define GETTY "/sbin/getty" /* Default location of getty */
58#define SHELL "/bin/sh" /* Default shell */ 59#define SHELL "/bin/sh" /* Default shell */
59#define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */ 60#define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */
60 61
@@ -446,15 +447,19 @@ static void reboot_signal(int sig)
446 447
447extern int init_main(int argc, char **argv) 448extern int init_main(int argc, char **argv)
448{ 449{
449 int run_rc = TRUE; 450 int run_rc = FALSE;
450 int wait_for_enter = TRUE; 451 int single = FALSE;
452 int wait_for_enter_tty1 = TRUE;
453 int wait_for_enter_tty2 = TRUE;
451 pid_t pid1 = 0; 454 pid_t pid1 = 0;
452 pid_t pid2 = 0; 455 pid_t pid2 = 0;
453 struct stat statbuf; 456 struct stat statbuf;
454 const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0}; 457 const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0};
458 const char* const getty1_command[] = { GETTY, GETTY, VT_PRIMARY, 0};
459 const char* const getty2_command[] = { GETTY, GETTY, VT_SECONDARY, 0};
455 const char* const shell_command[] = { SHELL, "-" SHELL, 0}; 460 const char* const shell_command[] = { SHELL, "-" SHELL, 0};
456 const char* const* tty0_command = shell_command;
457 const char* const* tty1_command = shell_command; 461 const char* const* tty1_command = shell_command;
462 const char* const* tty2_command = shell_command;
458#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS 463#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS
459 const char* const rc_exit_command[] = { "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 464 const char* const rc_exit_command[] = { "BB_INIT_CMD_IF_RC_SCRIPT_EXITS",
460 "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 0 }; 465 "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 0 };
@@ -477,13 +482,6 @@ extern int init_main(int argc, char **argv)
477 } 482 }
478#endif 483#endif
479 484
480 /* Check if we are supposed to be in single user mode */
481 if ( argc > 1 && (!strcmp(argv[1], "single") ||
482 !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) {
483 run_rc = FALSE;
484 }
485
486
487 /* Set up sig handlers -- be sure to 485 /* Set up sig handlers -- be sure to
488 * clear all of these in run() */ 486 * clear all of these in run() */
489 signal(SIGUSR1, halt_signal); 487 signal(SIGUSR1, halt_signal);
@@ -529,27 +527,55 @@ extern int init_main(int argc, char **argv)
529 /* Make sure there is enough memory to do something useful. */ 527 /* Make sure there is enough memory to do something useful. */
530 check_memory(); 528 check_memory();
531 529
530 /* Check if we are supposed to be in single user mode */
531 if ( argc > 1 && (!strcmp(argv[1], "single") ||
532 !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) {
533 single = TRUE;
534 tty1_command = shell_command;
535 tty2_command = shell_command;
536 }
532 537
533 /* Make sure an init script exists before trying to run it */ 538 /* Make sure an init script exists before trying to run it */
534 if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) { 539 if (single==FALSE && stat(INITSCRIPT, &statbuf)==0) {
535 wait_for_enter = FALSE; 540 run_rc = TRUE;
536 tty0_command = rc_script_command; 541 wait_for_enter_tty1 = FALSE;
542 tty1_command = rc_script_command;
537 } 543 }
544
545 /* Make sure /sbin/getty exists before trying to run it */
546 if (stat(GETTY, &statbuf)==0) {
547 char* where;
548 wait_for_enter_tty2 = FALSE;
549 where = strrchr( console, '/');
550 if ( where != NULL) {
551 strcpy( (char*)getty2_command[2], where);
552 }
553 tty2_command = getty2_command;
554 /* Check on hooking a getty onto tty1 */
555 if (run_rc == FALSE && single==FALSE) {
556 wait_for_enter_tty1 = FALSE;
557 where = strrchr( second_console, '/');
558 if ( where != NULL) {
559 strcpy( (char*)getty1_command[2], where);
560 }
561 tty1_command = getty1_command;
562 }
563 }
564
538 565
539 566 /* Ok, now launch the tty1_command and tty2_command */
540 /* Ok, now launch the rc script and/or prepare to
541 * start up some VTs if somebody hits enter...
542 */
543 for (;;) { 567 for (;;) {
544 pid_t wpid; 568 pid_t wpid;
545 int status; 569 int status;
546 570
547 if (pid1 == 0 && tty0_command) { 571 if (pid1 == 0 && tty1_command) {
548 pid1 = run(tty0_command, console, wait_for_enter); 572 pid1 = run(tty1_command, console, wait_for_enter_tty1);
549 } 573 }
550 if (pid2 == 0 && tty1_command && second_console) { 574#ifdef BB_FEATURE_INIT_SECOND_CONSOLE
551 pid2 = run(tty1_command, second_console, TRUE); 575 if (pid2 == 0 && tty2_command && second_console) {
576 pid2 = run(tty2_command, second_console, wait_for_enter_tty2);
552 } 577 }
578#endif
553 wpid = wait(&status); 579 wpid = wait(&status);
554 if (wpid > 0 ) { 580 if (wpid > 0 ) {
555 message(LOG, "pid %d exited, status=%x.\n", wpid, status); 581 message(LOG, "pid %d exited, status=%x.\n", wpid, status);
@@ -563,14 +589,16 @@ extern int init_main(int argc, char **argv)
563 else { 589 else {
564 pid1 = 0; 590 pid1 = 0;
565 run_rc=FALSE; 591 run_rc=FALSE;
566 wait_for_enter=TRUE; 592 wait_for_enter_tty1=TRUE;
567 tty0_command=rc_exit_command; 593 tty1_command=rc_exit_command;
568 } 594 }
569#endif 595#endif
570 } 596 }
597#ifdef BB_FEATURE_INIT_SECOND_CONSOLE
571 if (wpid == pid2) { 598 if (wpid == pid2) {
572 pid2 = 0; 599 pid2 = 0;
573 } 600 }
601#endif
574 sleep(1); 602 sleep(1);
575 } 603 }
576} 604}
diff --git a/install.sh b/install.sh
index 670c0c6e1..769d1f4a3 100755
--- a/install.sh
+++ b/install.sh
@@ -12,8 +12,7 @@ h=`sort busybox.links | uniq`
12for i in $h ; do 12for i in $h ; do
13 echo " $1$i -> /bin/busybox" 13 echo " $1$i -> /bin/busybox"
14 mkdir -p $1/`echo $i | sed -e 's/\/[^\/]*$//' ` 14 mkdir -p $1/`echo $i | sed -e 's/\/[^\/]*$//' `
15 rm -f $1$i 15 ln -fs /bin/busybox $1$i
16 ln -s /bin/busybox $1$i
17done 16done
18rm -f $1/bin/busybox 17rm -f $1/bin/busybox
19install -m 755 busybox $1/bin/busybox 18install -m 755 busybox $1/bin/busybox
diff --git a/umount.c b/umount.c
index 3bd86814e..522498be7 100644
--- a/umount.c
+++ b/umount.c
@@ -107,6 +107,12 @@ umount_all(int useMtab)
107extern int 107extern int
108umount_main(int argc, char** argv) 108umount_main(int argc, char** argv)
109{ 109{
110 int i=0;
111 char **foo=argv;
112 while(*foo) {
113 fprintf(stderr, "argv[%d]='%s'\n", i++, *foo);
114 foo++;
115 }
110 116
111 if (argc < 2) { 117 if (argc < 2) {
112 usage( umount_usage); 118 usage( umount_usage);
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 3bd86814e..522498be7 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -107,6 +107,12 @@ umount_all(int useMtab)
107extern int 107extern int
108umount_main(int argc, char** argv) 108umount_main(int argc, char** argv)
109{ 109{
110 int i=0;
111 char **foo=argv;
112 while(*foo) {
113 fprintf(stderr, "argv[%d]='%s'\n", i++, *foo);
114 foo++;
115 }
110 116
111 if (argc < 2) { 117 if (argc < 2) {
112 usage( umount_usage); 118 usage( umount_usage);