From ed85746acec7a5dab5b8fa8e5ff08a82325c295b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 1 Nov 2004 21:44:23 +0000 Subject: [PATCH] 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 --- src/kernel/core/main.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/kernel/core/main.c b/src/kernel/core/main.c index 486dbe05d6..b5d13c9652 100644 --- a/src/kernel/core/main.c +++ b/src/kernel/core/main.c @@ -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;