FirstBootPrompt: launch installer/desktop targets directly.

* No need for shell scripting here.
This commit is contained in:
Axel Dörfler
2015-07-22 20:43:44 +02:00
parent bd1c9bf338
commit 4c67f79c2c
5 changed files with 26 additions and 8 deletions
+5 -3
View File
@@ -11,9 +11,11 @@ target desktop {
} }
target first_boot { target first_boot {
job x-vnd.Haiku-FirstBootPrompt { job x-vnd.Haiku-FirstBootPrompt
legacy }
}
target installer {
job x-vnd.Haiku-Installer
} }
run { run {
+4 -1
View File
@@ -22,7 +22,10 @@ public:
port_id GetPort(const char* signature, port_id GetPort(const char* signature,
const char* name); const char* name);
status_t Target(const char* name, BMessage& data, status_t Target(const char* name, const BMessage& data,
const char* baseName = NULL);
status_t Target(const char* name,
const BMessage* data = NULL,
const char* baseName = NULL); const char* baseName = NULL);
status_t StartSession(const char* login); status_t StartSession(const char* login);
+4
View File
@@ -3,11 +3,13 @@
* All rights reserved. Distributed under the terms of the MIT License. * All rights reserved. Distributed under the terms of the MIT License.
*/ */
#include "BootPrompt.h" #include "BootPrompt.h"
#include <stdlib.h> #include <stdlib.h>
#include <Catalog.h> #include <Catalog.h>
#include <LaunchRoster.h>
#include <Locale.h> #include <Locale.h>
#include "BootPromptWindow.h" #include "BootPromptWindow.h"
@@ -43,10 +45,12 @@ BootPromptApp::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case MSG_BOOT_DESKTOP: case MSG_BOOT_DESKTOP:
BLaunchRoster().Target("desktop");
sExitValue = 1; sExitValue = 1;
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
break; break;
case MSG_RUN_INSTALLER: case MSG_RUN_INSTALLER:
BLaunchRoster().Target("installer");
sExitValue = 0; sExitValue = 0;
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
break; break;
+1 -1
View File
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src apps firstbootprompt ; SubDir HAIKU_TOP src apps firstbootprompt ;
UsePrivateHeaders interface locale shared ; UsePrivateHeaders app interface locale shared ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src preferences keymap ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src preferences keymap ] ;
+12 -3
View File
@@ -146,7 +146,16 @@ BLaunchRoster::GetPort(const char* signature, const char* name)
status_t status_t
BLaunchRoster::Target(const char* name, BMessage& data, const char* baseName) BLaunchRoster::Target(const char* name, const BMessage& data,
const char* baseName)
{
return Target(name, &data, baseName);
}
status_t
BLaunchRoster::Target(const char* name, const BMessage* data,
const char* baseName)
{ {
if (name == NULL) if (name == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -155,8 +164,8 @@ BLaunchRoster::Target(const char* name, BMessage& data, const char* baseName)
status_t status = request.AddInt32("user", getuid()); status_t status = request.AddInt32("user", getuid());
if (status == B_OK) if (status == B_OK)
status = request.AddString("target", name); status = request.AddString("target", name);
if (status == B_OK && !data.IsEmpty()) if (status == B_OK && data != NULL && !data->IsEmpty())
status = request.AddMessage("data", &data); status = request.AddMessage("data", data);
if (status == B_OK && baseName != NULL) if (status == B_OK && baseName != NULL)
status = request.AddString("base target", baseName); status = request.AddString("base target", baseName);
if (status != B_OK) if (status != B_OK)