mirror of
https://github.com/sheumann/hush.git
synced 2024-10-11 10:23:41 +00:00
Init is now even more perfect then before.
-Erik
This commit is contained in:
parent
286b0de74d
commit
96e2abd084
6
Makefile
6
Makefile
@ -80,12 +80,8 @@ LIBRARIES=
|
|||||||
OBJECTS=$(shell ./busybox.sh)
|
OBJECTS=$(shell ./busybox.sh)
|
||||||
CFLAGS+= -DBB_VER='"$(VERSION)"'
|
CFLAGS+= -DBB_VER='"$(VERSION)"'
|
||||||
CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
|
CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
|
||||||
ifdef BB_INIT_RC_EXIT_CMD
|
|
||||||
CFLAGS += -DBB_INIT_CMD_IF_RC_SCRIPT_EXITS=${BB_INIT_RC_EXIT_CMD}
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef BB_INIT_SCRIPT
|
ifdef BB_INIT_SCRIPT
|
||||||
CFLAGS += -DBB_INIT_SCRIPT=${BB_INIT_SCRIPT}
|
CFLAGS += -DINIT_SCRIPT=${BB_INIT_SCRIPT}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: busybox busybox.links
|
all: busybox busybox.links
|
||||||
|
@ -88,6 +88,12 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
// Don't turn BB_UTILITY off. It contains support code
|
||||||
|
// that compiles to 0 if everything else if turned off.
|
||||||
|
#define BB_UTILITY
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
// This is where feature definitions go. Generally speaking,
|
// This is where feature definitions go. Generally speaking,
|
||||||
// turning this stuff off makes things a bit smaller (and less
|
// turning this stuff off makes things a bit smaller (and less
|
||||||
// pretty/useful).
|
// pretty/useful).
|
||||||
@ -113,10 +119,3 @@
|
|||||||
//Enable init being called as /linuxrc
|
//Enable init being called as /linuxrc
|
||||||
#define BB_FEATURE_LINUXRC
|
#define BB_FEATURE_LINUXRC
|
||||||
//
|
//
|
||||||
//
|
|
||||||
//
|
|
||||||
// Don't turn BB_UTILITY off. It contains support code
|
|
||||||
// that compiles to 0 if everything else if turned off.
|
|
||||||
#define BB_UTILITY
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
@ -21,7 +21,7 @@ embedded system.
|
|||||||
%setup -q -n %{Name}-%{Version}
|
%setup -q -n %{Name}-%{Version}
|
||||||
|
|
||||||
%Build
|
%Build
|
||||||
BB_INIT_RC_EXIT_CMD=\"/bin/sh\" BB_INIT_SCRIPT=\"/etc/rc.d/init.d/rcS\" make
|
BB_INIT_SCRIPT='\"/etc/rc.d/init.d/rcS\"' make
|
||||||
|
|
||||||
%Install
|
%Install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
@ -21,7 +21,7 @@ embedded system.
|
|||||||
%setup -q -n %{Name}-%{Version}
|
%setup -q -n %{Name}-%{Version}
|
||||||
|
|
||||||
%Build
|
%Build
|
||||||
BB_INIT_RC_EXIT_CMD=\"/bin/sh\" BB_INIT_SCRIPT=\"/etc/rc.d/init.d/rcS\" make
|
BB_INIT_SCRIPT='\"/etc/rc.d/init.d/rcS\"' make
|
||||||
|
|
||||||
%Install
|
%Install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
46
init.c
46
init.c
@ -61,9 +61,11 @@
|
|||||||
#define VT_LOG "/dev/tty3" /* Virtual console */
|
#define VT_LOG "/dev/tty3" /* Virtual console */
|
||||||
#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
|
#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
|
||||||
#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
|
#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
|
||||||
#define SHELL "-sh" /* Default shell */
|
#define SHELL "/bin/sh" /* Default shell */
|
||||||
#define INITTAB "/etc/inittab" /* inittab file location */
|
#define INITTAB "/etc/inittab" /* inittab file location */
|
||||||
|
#ifndef INIT_SCRIPT
|
||||||
#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
|
#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOG 0x1
|
#define LOG 0x1
|
||||||
#define CONSOLE 0x2
|
#define CONSOLE 0x2
|
||||||
@ -330,6 +332,7 @@ static pid_t run(char* command,
|
|||||||
"\nPlease press Enter to activate this console. ";
|
"\nPlease press Enter to activate this console. ";
|
||||||
|
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
|
int fd;
|
||||||
pid_t shell_pgid = getpid ();
|
pid_t shell_pgid = getpid ();
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
@ -338,17 +341,14 @@ static pid_t run(char* command,
|
|||||||
close(2);
|
close(2);
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
if (device_open(terminal, O_RDWR) < 0) {
|
if ((fd=device_open(terminal, O_RDWR)) < 0) {
|
||||||
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
dup(0);
|
dup(fd);
|
||||||
dup(0);
|
dup(fd);
|
||||||
/* Grab control of the terminal. */
|
set_term(fd);
|
||||||
if (tcsetpgrp (0, getpgrp()) < 0) {
|
tcsetpgrp (fd, getpgrp());
|
||||||
message(LOG|CONSOLE, "tcsetpgrp error: %s\r\n", strerror(errno));
|
|
||||||
}
|
|
||||||
set_term(0);
|
|
||||||
|
|
||||||
/* Reset signal handlers set for parent process */
|
/* Reset signal handlers set for parent process */
|
||||||
signal(SIGUSR1, SIG_DFL);
|
signal(SIGUSR1, SIG_DFL);
|
||||||
@ -497,7 +497,7 @@ static void reboot_signal(int sig)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void new_initAction (const struct initActionType *a,
|
void new_initAction (initActionEnum action,
|
||||||
char* process, char* cons)
|
char* process, char* cons)
|
||||||
{
|
{
|
||||||
initAction* newAction;
|
initAction* newAction;
|
||||||
@ -517,7 +517,7 @@ void new_initAction (const struct initActionType *a,
|
|||||||
newAction->nextPtr = initActionList;
|
newAction->nextPtr = initActionList;
|
||||||
initActionList = newAction;
|
initActionList = newAction;
|
||||||
strncpy( newAction->process, process, 255);
|
strncpy( newAction->process, process, 255);
|
||||||
newAction->action = a->action;
|
newAction->action = action;
|
||||||
if (*cons != '\0') {
|
if (*cons != '\0') {
|
||||||
strncpy(newAction->console, cons, 255);
|
strncpy(newAction->console, cons, 255);
|
||||||
} else
|
} else
|
||||||
@ -561,12 +561,12 @@ void parse_inittab(void)
|
|||||||
/* No inittab file -- set up some default behavior */
|
/* No inittab file -- set up some default behavior */
|
||||||
#endif
|
#endif
|
||||||
/* Askfirst shell on tty1 */
|
/* Askfirst shell on tty1 */
|
||||||
new_initAction( &(actions[3]), SHELL, console );
|
new_initAction( ASKFIRST, SHELL, console );
|
||||||
/* Askfirst shell on tty2 */
|
/* Askfirst shell on tty2 */
|
||||||
if (second_console != NULL)
|
if (second_console != NULL)
|
||||||
new_initAction( &(actions[3]), SHELL, second_console );
|
new_initAction( ASKFIRST, SHELL, second_console );
|
||||||
/* sysinit */
|
/* sysinit */
|
||||||
new_initAction( &(actions[0]), INIT_SCRIPT, console );
|
new_initAction( SYSINIT, INIT_SCRIPT, console );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
#ifdef BB_FEATURE_USE_INITTAB
|
#ifdef BB_FEATURE_USE_INITTAB
|
||||||
@ -584,7 +584,6 @@ void parse_inittab(void)
|
|||||||
|
|
||||||
/* Keep a copy around for posterity's sake (and error msgs) */
|
/* Keep a copy around for posterity's sake (and error msgs) */
|
||||||
strcpy(lineAsRead, buf);
|
strcpy(lineAsRead, buf);
|
||||||
message(LOG|CONSOLE, "read='%s'\n", lineAsRead);
|
|
||||||
|
|
||||||
/* Grab the ID field */
|
/* Grab the ID field */
|
||||||
s=p;
|
s=p;
|
||||||
@ -628,7 +627,7 @@ message(LOG|CONSOLE, "read='%s'\n", lineAsRead);
|
|||||||
}
|
}
|
||||||
s = tmpConsole;
|
s = tmpConsole;
|
||||||
}
|
}
|
||||||
new_initAction( a, q, s);
|
new_initAction( a->action, q, s);
|
||||||
foundIt=TRUE;
|
foundIt=TRUE;
|
||||||
}
|
}
|
||||||
a++;
|
a++;
|
||||||
@ -712,9 +711,9 @@ extern int init_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
/* Ask first then start a shell on tty2 */
|
/* Ask first then start a shell on tty2 */
|
||||||
if (second_console != NULL)
|
if (second_console != NULL)
|
||||||
new_initAction( &(actions[3]), SHELL, second_console);
|
new_initAction( ASKFIRST, SHELL, second_console);
|
||||||
/* Ask first then start a shell on tty1 */
|
/* Ask first then start a shell on tty1 */
|
||||||
new_initAction( &(actions[3]), SHELL, console);
|
new_initAction( ASKFIRST, SHELL, console);
|
||||||
} else {
|
} else {
|
||||||
/* Not in single user mode -- see what inittab says */
|
/* Not in single user mode -- see what inittab says */
|
||||||
|
|
||||||
@ -731,7 +730,7 @@ extern int init_main(int argc, char **argv)
|
|||||||
/* First run the sysinit command */
|
/* First run the sysinit command */
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
if (a->action == SYSINIT) {
|
if (a->action == SYSINIT) {
|
||||||
waitfor(a->process, console, FALSE);
|
waitfor(a->process, a->console, FALSE);
|
||||||
/* Now remove the "sysinit" entry from the list */
|
/* Now remove the "sysinit" entry from the list */
|
||||||
delete_initAction( a);
|
delete_initAction( a);
|
||||||
}
|
}
|
||||||
@ -739,7 +738,7 @@ extern int init_main(int argc, char **argv)
|
|||||||
/* Next run anything that wants to block */
|
/* Next run anything that wants to block */
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
if (a->action == WAIT) {
|
if (a->action == WAIT) {
|
||||||
waitfor(a->process, console, FALSE);
|
waitfor(a->process, a->console, FALSE);
|
||||||
/* Now remove the "wait" entry from the list */
|
/* Now remove the "wait" entry from the list */
|
||||||
delete_initAction( a);
|
delete_initAction( a);
|
||||||
}
|
}
|
||||||
@ -747,7 +746,7 @@ extern int init_main(int argc, char **argv)
|
|||||||
/* Next run anything to be run only once */
|
/* Next run anything to be run only once */
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
if (a->action == ONCE) {
|
if (a->action == ONCE) {
|
||||||
run(a->process, console, FALSE);
|
run(a->process, a->console, FALSE);
|
||||||
/* Now remove the "once" entry from the list */
|
/* Now remove the "once" entry from the list */
|
||||||
delete_initAction( a);
|
delete_initAction( a);
|
||||||
}
|
}
|
||||||
@ -760,7 +759,6 @@ extern int init_main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Now run the looping stuff for the rest of forever */
|
/* Now run the looping stuff for the rest of forever */
|
||||||
while (1) {
|
while (1) {
|
||||||
message(LOG|CONSOLE, "Looping\n");
|
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
/* Only run stuff with pid==0. If they have
|
/* Only run stuff with pid==0. If they have
|
||||||
* a pid, that means they are still running */
|
* a pid, that means they are still running */
|
||||||
@ -768,11 +766,11 @@ extern int init_main(int argc, char **argv)
|
|||||||
switch(a->action) {
|
switch(a->action) {
|
||||||
case RESPAWN:
|
case RESPAWN:
|
||||||
/* run the respawn stuff */
|
/* run the respawn stuff */
|
||||||
a->pid = run(a->process, console, FALSE);
|
a->pid = run(a->process, a->console, FALSE);
|
||||||
break;
|
break;
|
||||||
case ASKFIRST:
|
case ASKFIRST:
|
||||||
/* run the askfirst stuff */
|
/* run the askfirst stuff */
|
||||||
a->pid = run(a->process, console, TRUE);
|
a->pid = run(a->process, a->console, TRUE);
|
||||||
break;
|
break;
|
||||||
/* silence the compiler's incessant whining */
|
/* silence the compiler's incessant whining */
|
||||||
default:
|
default:
|
||||||
|
46
init/init.c
46
init/init.c
@ -61,9 +61,11 @@
|
|||||||
#define VT_LOG "/dev/tty3" /* Virtual console */
|
#define VT_LOG "/dev/tty3" /* Virtual console */
|
||||||
#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
|
#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
|
||||||
#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
|
#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
|
||||||
#define SHELL "-sh" /* Default shell */
|
#define SHELL "/bin/sh" /* Default shell */
|
||||||
#define INITTAB "/etc/inittab" /* inittab file location */
|
#define INITTAB "/etc/inittab" /* inittab file location */
|
||||||
|
#ifndef INIT_SCRIPT
|
||||||
#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
|
#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOG 0x1
|
#define LOG 0x1
|
||||||
#define CONSOLE 0x2
|
#define CONSOLE 0x2
|
||||||
@ -330,6 +332,7 @@ static pid_t run(char* command,
|
|||||||
"\nPlease press Enter to activate this console. ";
|
"\nPlease press Enter to activate this console. ";
|
||||||
|
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
|
int fd;
|
||||||
pid_t shell_pgid = getpid ();
|
pid_t shell_pgid = getpid ();
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
@ -338,17 +341,14 @@ static pid_t run(char* command,
|
|||||||
close(2);
|
close(2);
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
if (device_open(terminal, O_RDWR) < 0) {
|
if ((fd=device_open(terminal, O_RDWR)) < 0) {
|
||||||
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
dup(0);
|
dup(fd);
|
||||||
dup(0);
|
dup(fd);
|
||||||
/* Grab control of the terminal. */
|
set_term(fd);
|
||||||
if (tcsetpgrp (0, getpgrp()) < 0) {
|
tcsetpgrp (fd, getpgrp());
|
||||||
message(LOG|CONSOLE, "tcsetpgrp error: %s\r\n", strerror(errno));
|
|
||||||
}
|
|
||||||
set_term(0);
|
|
||||||
|
|
||||||
/* Reset signal handlers set for parent process */
|
/* Reset signal handlers set for parent process */
|
||||||
signal(SIGUSR1, SIG_DFL);
|
signal(SIGUSR1, SIG_DFL);
|
||||||
@ -497,7 +497,7 @@ static void reboot_signal(int sig)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void new_initAction (const struct initActionType *a,
|
void new_initAction (initActionEnum action,
|
||||||
char* process, char* cons)
|
char* process, char* cons)
|
||||||
{
|
{
|
||||||
initAction* newAction;
|
initAction* newAction;
|
||||||
@ -517,7 +517,7 @@ void new_initAction (const struct initActionType *a,
|
|||||||
newAction->nextPtr = initActionList;
|
newAction->nextPtr = initActionList;
|
||||||
initActionList = newAction;
|
initActionList = newAction;
|
||||||
strncpy( newAction->process, process, 255);
|
strncpy( newAction->process, process, 255);
|
||||||
newAction->action = a->action;
|
newAction->action = action;
|
||||||
if (*cons != '\0') {
|
if (*cons != '\0') {
|
||||||
strncpy(newAction->console, cons, 255);
|
strncpy(newAction->console, cons, 255);
|
||||||
} else
|
} else
|
||||||
@ -561,12 +561,12 @@ void parse_inittab(void)
|
|||||||
/* No inittab file -- set up some default behavior */
|
/* No inittab file -- set up some default behavior */
|
||||||
#endif
|
#endif
|
||||||
/* Askfirst shell on tty1 */
|
/* Askfirst shell on tty1 */
|
||||||
new_initAction( &(actions[3]), SHELL, console );
|
new_initAction( ASKFIRST, SHELL, console );
|
||||||
/* Askfirst shell on tty2 */
|
/* Askfirst shell on tty2 */
|
||||||
if (second_console != NULL)
|
if (second_console != NULL)
|
||||||
new_initAction( &(actions[3]), SHELL, second_console );
|
new_initAction( ASKFIRST, SHELL, second_console );
|
||||||
/* sysinit */
|
/* sysinit */
|
||||||
new_initAction( &(actions[0]), INIT_SCRIPT, console );
|
new_initAction( SYSINIT, INIT_SCRIPT, console );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
#ifdef BB_FEATURE_USE_INITTAB
|
#ifdef BB_FEATURE_USE_INITTAB
|
||||||
@ -584,7 +584,6 @@ void parse_inittab(void)
|
|||||||
|
|
||||||
/* Keep a copy around for posterity's sake (and error msgs) */
|
/* Keep a copy around for posterity's sake (and error msgs) */
|
||||||
strcpy(lineAsRead, buf);
|
strcpy(lineAsRead, buf);
|
||||||
message(LOG|CONSOLE, "read='%s'\n", lineAsRead);
|
|
||||||
|
|
||||||
/* Grab the ID field */
|
/* Grab the ID field */
|
||||||
s=p;
|
s=p;
|
||||||
@ -628,7 +627,7 @@ message(LOG|CONSOLE, "read='%s'\n", lineAsRead);
|
|||||||
}
|
}
|
||||||
s = tmpConsole;
|
s = tmpConsole;
|
||||||
}
|
}
|
||||||
new_initAction( a, q, s);
|
new_initAction( a->action, q, s);
|
||||||
foundIt=TRUE;
|
foundIt=TRUE;
|
||||||
}
|
}
|
||||||
a++;
|
a++;
|
||||||
@ -712,9 +711,9 @@ extern int init_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
/* Ask first then start a shell on tty2 */
|
/* Ask first then start a shell on tty2 */
|
||||||
if (second_console != NULL)
|
if (second_console != NULL)
|
||||||
new_initAction( &(actions[3]), SHELL, second_console);
|
new_initAction( ASKFIRST, SHELL, second_console);
|
||||||
/* Ask first then start a shell on tty1 */
|
/* Ask first then start a shell on tty1 */
|
||||||
new_initAction( &(actions[3]), SHELL, console);
|
new_initAction( ASKFIRST, SHELL, console);
|
||||||
} else {
|
} else {
|
||||||
/* Not in single user mode -- see what inittab says */
|
/* Not in single user mode -- see what inittab says */
|
||||||
|
|
||||||
@ -731,7 +730,7 @@ extern int init_main(int argc, char **argv)
|
|||||||
/* First run the sysinit command */
|
/* First run the sysinit command */
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
if (a->action == SYSINIT) {
|
if (a->action == SYSINIT) {
|
||||||
waitfor(a->process, console, FALSE);
|
waitfor(a->process, a->console, FALSE);
|
||||||
/* Now remove the "sysinit" entry from the list */
|
/* Now remove the "sysinit" entry from the list */
|
||||||
delete_initAction( a);
|
delete_initAction( a);
|
||||||
}
|
}
|
||||||
@ -739,7 +738,7 @@ extern int init_main(int argc, char **argv)
|
|||||||
/* Next run anything that wants to block */
|
/* Next run anything that wants to block */
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
if (a->action == WAIT) {
|
if (a->action == WAIT) {
|
||||||
waitfor(a->process, console, FALSE);
|
waitfor(a->process, a->console, FALSE);
|
||||||
/* Now remove the "wait" entry from the list */
|
/* Now remove the "wait" entry from the list */
|
||||||
delete_initAction( a);
|
delete_initAction( a);
|
||||||
}
|
}
|
||||||
@ -747,7 +746,7 @@ extern int init_main(int argc, char **argv)
|
|||||||
/* Next run anything to be run only once */
|
/* Next run anything to be run only once */
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
if (a->action == ONCE) {
|
if (a->action == ONCE) {
|
||||||
run(a->process, console, FALSE);
|
run(a->process, a->console, FALSE);
|
||||||
/* Now remove the "once" entry from the list */
|
/* Now remove the "once" entry from the list */
|
||||||
delete_initAction( a);
|
delete_initAction( a);
|
||||||
}
|
}
|
||||||
@ -760,7 +759,6 @@ extern int init_main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Now run the looping stuff for the rest of forever */
|
/* Now run the looping stuff for the rest of forever */
|
||||||
while (1) {
|
while (1) {
|
||||||
message(LOG|CONSOLE, "Looping\n");
|
|
||||||
for( a=initActionList ; a; a=a->nextPtr) {
|
for( a=initActionList ; a; a=a->nextPtr) {
|
||||||
/* Only run stuff with pid==0. If they have
|
/* Only run stuff with pid==0. If they have
|
||||||
* a pid, that means they are still running */
|
* a pid, that means they are still running */
|
||||||
@ -768,11 +766,11 @@ extern int init_main(int argc, char **argv)
|
|||||||
switch(a->action) {
|
switch(a->action) {
|
||||||
case RESPAWN:
|
case RESPAWN:
|
||||||
/* run the respawn stuff */
|
/* run the respawn stuff */
|
||||||
a->pid = run(a->process, console, FALSE);
|
a->pid = run(a->process, a->console, FALSE);
|
||||||
break;
|
break;
|
||||||
case ASKFIRST:
|
case ASKFIRST:
|
||||||
/* run the askfirst stuff */
|
/* run the askfirst stuff */
|
||||||
a->pid = run(a->process, console, TRUE);
|
a->pid = run(a->process, a->console, TRUE);
|
||||||
break;
|
break;
|
||||||
/* silence the compiler's incessant whining */
|
/* silence the compiler's incessant whining */
|
||||||
default:
|
default:
|
||||||
|
40
reg_test.sh
40
reg_test.sh
@ -6,26 +6,22 @@ rm -rf testdir
|
|||||||
./busybox cp tar.c testdir
|
./busybox cp tar.c testdir
|
||||||
|
|
||||||
if ! eval diff -u tar.c testdir ; then
|
if ! eval diff -u tar.c testdir ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. File copy failed."
|
echo "Bummer. File copy failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. File copy is ok."
|
echo "Cool. File copy is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
rm -rf testdir
|
rm -rf testdir
|
||||||
mkdir -p testdir/foo
|
mkdir -p testdir/foo
|
||||||
./busybox cp tar.c testdir/foo
|
./busybox cp tar.c testdir/foo
|
||||||
|
|
||||||
if ! eval diff -u tar.c testdir/foo/tar.c ; then
|
if ! eval diff -u tar.c testdir/foo/tar.c ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. File copy to a directory failed."
|
echo "Bummer. File copy to a directory failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. File copy to a directory is ok."
|
echo "Cool. File copy to a directory is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
|
|
||||||
rm -rf testdir
|
rm -rf testdir
|
||||||
@ -33,13 +29,11 @@ mkdir -p testdir/foo
|
|||||||
./busybox cp tar.c testdir/foo/
|
./busybox cp tar.c testdir/foo/
|
||||||
|
|
||||||
if ! eval diff -u tar.c testdir/foo/tar.c ; then
|
if ! eval diff -u tar.c testdir/foo/tar.c ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. File copy to a directory w/ a '/' failed."
|
echo "Bummer. File copy to a directory w/ a '/' failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. File copy to a directory w/ a '/' is ok."
|
echo "Cool. File copy to a directory w/ a '/' is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
|
|
||||||
rm -rf testdir X11
|
rm -rf testdir X11
|
||||||
@ -47,63 +41,53 @@ cp -a /etc/X11 .
|
|||||||
./busybox cp -a X11 testdir
|
./busybox cp -a X11 testdir
|
||||||
|
|
||||||
if ! eval diff -ur X11 testdir ; then
|
if ! eval diff -ur X11 testdir ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. Local dir copy failed."
|
echo "Bummer. Local dir copy failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. Local dir copy is ok."
|
echo "Cool. Local dir copy is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
rm -rf testdir X11
|
rm -rf testdir X11
|
||||||
cp -a /etc/X11 .
|
cp -a /etc/X11 .
|
||||||
./busybox cp -a X11 testdir/
|
./busybox cp -a X11 testdir/
|
||||||
|
|
||||||
if ! eval diff -ur X11 testdir ; then
|
if ! eval diff -ur X11 testdir ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. Local dir copy w/ a '/' failed."
|
echo "Bummer. Local dir copy w/ a '/' failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. Local dir copy w/ a '/' is ok."
|
echo "Cool. Local dir copy w/ a '/' is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
rm -rf testdir X11
|
rm -rf testdir X11
|
||||||
cp -a /etc/X11 .
|
cp -a /etc/X11 .
|
||||||
./busybox cp -a X11/ testdir
|
./busybox cp -a X11/ testdir
|
||||||
|
|
||||||
if ! eval diff -ur X11 testdir ; then
|
if ! eval diff -ur X11 testdir ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. Local dir copy w/ a src '/' failed."
|
echo "Bummer. Local dir copy w/ a src '/' failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. Local dir copy w/ a src '/' is ok."
|
echo "Cool. Local dir copy w/ a src '/' is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
rm -rf testdir X11
|
rm -rf testdir X11
|
||||||
cp -a /etc/X11 .
|
cp -a /etc/X11 .
|
||||||
./busybox cp -a X11/ testdir/
|
./busybox cp -a X11/ testdir/
|
||||||
|
|
||||||
if ! eval diff -ur X11 testdir ; then
|
if ! eval diff -ur X11 testdir ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. Local dir copy w/ 2x '/'s failed."
|
echo "Bummer. Local dir copy w/ 2x '/'s failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. Local dir copy w/ 2x '/'s is ok."
|
echo "Cool. Local dir copy w/ 2x '/'s is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
rm -rf testdir X11
|
rm -rf testdir X11
|
||||||
./busybox cp -a /etc/X11 testdir
|
./busybox cp -a /etc/X11 testdir
|
||||||
if ! eval diff -ur /etc/X11 testdir ; then
|
if ! eval diff -ur /etc/X11 testdir ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. Remote dir copy failed."
|
echo "Bummer. Remote dir copy failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. Remote dir copy is ok."
|
echo "Cool. Remote dir copy is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
|
|
||||||
rm -rf testdir X11
|
rm -rf testdir X11
|
||||||
@ -111,13 +95,11 @@ mkdir -p testdir/foo
|
|||||||
|
|
||||||
./busybox cp -a /etc/X11 testdir/foo
|
./busybox cp -a /etc/X11 testdir/foo
|
||||||
if ! eval diff -ur /etc/X11 testdir/foo ; then
|
if ! eval diff -ur /etc/X11 testdir/foo ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. Remote dir copy to a directory failed."
|
echo "Bummer. Remote dir copy to a directory failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Cool. Remote dir copy to a directory is ok."
|
echo "Cool. Remote dir copy to a directory is ok."
|
||||||
fi
|
fi
|
||||||
echo " "
|
|
||||||
|
|
||||||
|
|
||||||
rm -rf testdir X11
|
rm -rf testdir X11
|
||||||
@ -125,7 +107,6 @@ mkdir -p testdir/foo
|
|||||||
|
|
||||||
./busybox cp -a /etc/X11 testdir/foo/
|
./busybox cp -a /etc/X11 testdir/foo/
|
||||||
if ! eval diff -ur /etc/X11 testdir/foo ; then
|
if ! eval diff -ur /etc/X11 testdir/foo ; then
|
||||||
echo " "
|
|
||||||
echo "Bummer. Remote dir copy to a directory w/ a '/' failed."
|
echo "Bummer. Remote dir copy to a directory w/ a '/' failed."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
@ -134,3 +115,24 @@ fi
|
|||||||
|
|
||||||
rm -rf testdir
|
rm -rf testdir
|
||||||
|
|
||||||
|
|
||||||
|
rm -rf foo bar
|
||||||
|
mkdir foo
|
||||||
|
mkdir bar
|
||||||
|
|
||||||
|
if ! eval ./busybox cp README foo ; then
|
||||||
|
echo "Bummer. cp README foo failed."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Cool. cp README foo is ok."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! eval ./busybox cp foo/README bar ; then
|
||||||
|
echo "Bummer. cp foo/README bar failed."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Cool. cp foo/README bar is ok."
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf foo bar
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user