If available, main2() will now execute the Bootscript. If not, it will fall
back to the old "init" command. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9720 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+20
-4
@@ -215,14 +215,30 @@ main2(void *unused)
|
|||||||
#endif
|
#endif
|
||||||
// start the init process
|
// start the init process
|
||||||
{
|
{
|
||||||
const char *args[] = {"/bin/init", NULL};
|
const char *shellArgs[] = {"/bin/sh", "/boot/beos/system/boot/Bootscript", NULL};
|
||||||
|
const char *initArgs[] = {"/bin/init", NULL};
|
||||||
|
const char **args;
|
||||||
|
int32 argc;
|
||||||
|
thread_id thread;
|
||||||
|
|
||||||
thread_id thread = load_image(1, args, NULL);
|
struct stat st;
|
||||||
|
if (stat(shellArgs[1], &st) == 0) {
|
||||||
|
// start Bootscript
|
||||||
|
args = shellArgs;
|
||||||
|
argc = 2;
|
||||||
|
} else {
|
||||||
|
// ToDo: this is only necessary as long as we have the bootdir mechanism
|
||||||
|
// start init
|
||||||
|
args = initArgs;
|
||||||
|
argc = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread = load_image(argc, args, NULL);
|
||||||
if (thread >= B_OK) {
|
if (thread >= B_OK) {
|
||||||
resume_thread(thread);
|
resume_thread(thread);
|
||||||
TRACE(("Init started\n"));
|
TRACE(("Bootscript started\n"));
|
||||||
} else
|
} else
|
||||||
dprintf("error starting 'init' error = %ld \n", thread);
|
dprintf("error starting \"%s\" error = %ld \n", args[0], thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user