From 4c67f79c2cf7d08667cd36242f1520f279a7ed33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 1 Jul 2015 14:19:23 +0200 Subject: [PATCH] FirstBootPrompt: launch installer/desktop targets directly. * No need for shell scripting here. --- data/launch/user | 8 +++++--- headers/private/app/LaunchRoster.h | 5 ++++- src/apps/firstbootprompt/BootPrompt.cpp | 4 ++++ src/apps/firstbootprompt/Jamfile | 2 +- src/kits/app/LaunchRoster.cpp | 15 ++++++++++++--- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/data/launch/user b/data/launch/user index 139c551820..66308e920d 100644 --- a/data/launch/user +++ b/data/launch/user @@ -11,9 +11,11 @@ target desktop { } target first_boot { - job x-vnd.Haiku-FirstBootPrompt { - legacy - } + job x-vnd.Haiku-FirstBootPrompt +} + +target installer { + job x-vnd.Haiku-Installer } run { diff --git a/headers/private/app/LaunchRoster.h b/headers/private/app/LaunchRoster.h index aaf7196832..6855c37dc1 100644 --- a/headers/private/app/LaunchRoster.h +++ b/headers/private/app/LaunchRoster.h @@ -22,7 +22,10 @@ public: port_id GetPort(const char* signature, 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); status_t StartSession(const char* login); diff --git a/src/apps/firstbootprompt/BootPrompt.cpp b/src/apps/firstbootprompt/BootPrompt.cpp index d25ac66950..c19a41c295 100644 --- a/src/apps/firstbootprompt/BootPrompt.cpp +++ b/src/apps/firstbootprompt/BootPrompt.cpp @@ -3,11 +3,13 @@ * All rights reserved. Distributed under the terms of the MIT License. */ + #include "BootPrompt.h" #include #include +#include #include #include "BootPromptWindow.h" @@ -43,10 +45,12 @@ BootPromptApp::MessageReceived(BMessage* message) { switch (message->what) { case MSG_BOOT_DESKTOP: + BLaunchRoster().Target("desktop"); sExitValue = 1; PostMessage(B_QUIT_REQUESTED); break; case MSG_RUN_INSTALLER: + BLaunchRoster().Target("installer"); sExitValue = 0; PostMessage(B_QUIT_REQUESTED); break; diff --git a/src/apps/firstbootprompt/Jamfile b/src/apps/firstbootprompt/Jamfile index da3700c068..9c73a2cf23 100644 --- a/src/apps/firstbootprompt/Jamfile +++ b/src/apps/firstbootprompt/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src apps firstbootprompt ; -UsePrivateHeaders interface locale shared ; +UsePrivateHeaders app interface locale shared ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src preferences keymap ] ; diff --git a/src/kits/app/LaunchRoster.cpp b/src/kits/app/LaunchRoster.cpp index 4a94fc1e65..00b41b9a05 100644 --- a/src/kits/app/LaunchRoster.cpp +++ b/src/kits/app/LaunchRoster.cpp @@ -146,7 +146,16 @@ BLaunchRoster::GetPort(const char* signature, const char* name) 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) 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()); if (status == B_OK) status = request.AddString("target", name); - if (status == B_OK && !data.IsEmpty()) - status = request.AddMessage("data", &data); + if (status == B_OK && data != NULL && !data->IsEmpty()) + status = request.AddMessage("data", data); if (status == B_OK && baseName != NULL) status = request.AddString("base target", baseName); if (status != B_OK)