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:
Axel Dörfler 2004-11-01 21:44:23 +00:00
parent e27751d3df
commit ed85746ace
1 changed files with 20 additions and 4 deletions

View File

@ -215,14 +215,30 @@ main2(void *unused)
#endif
// 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) {
resume_thread(thread);
TRACE(("Init started\n"));
TRACE(("Bootscript started\n"));
} else
dprintf("error starting 'init' error = %ld \n", thread);
dprintf("error starting \"%s\" error = %ld \n", args[0], thread);
}
return 0;