GError *error = NULL;
gchar *log_text;
- /* get a bus name on the given connection */
- application->bus_name_id =
- g_bus_own_name_on_connection (application->connection, "org.genivi.BootManager1",
- G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
-
/* instantiate the LUC starter */
application->luc_starter = luc_starter_new (application->job_manager,
application->boot_manager_service);
- /* attempt to start the boot manager service */
- if (!boot_manager_service_start_up (application->boot_manager_service, &error))
- {
- log_text = g_strdup_printf ("Failed to start the boot manager service: %s",
- error->message);
- DLT_LOG (boot_manager_context, DLT_LOG_ERROR, DLT_STRING (log_text));
- g_free (log_text);
- g_clear_error (&error);
- }
-
/* restore the LUC if desired */
luc_starter_start_groups (application->luc_starter);
- /* start the legacy app handler */
- if (!la_handler_service_start (application->la_handler, &error))
- {
- log_text = g_strdup_printf ("Failed to start the legacy app handler service: %s",
- error->message);
- DLT_LOG (boot_manager_context, DLT_LOG_ERROR, DLT_STRING (log_text));
- g_free (log_text);
- g_clear_error (&error);
- }
+ /* get a bus name on the given connection */
+ application->bus_name_id =
+ g_bus_own_name_on_connection (application->connection, "org.genivi.BootManager1",
+ G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
/* create a shutdown consumer and implement its LifecycleRequest method */
application->consumer = shutdown_consumer_skeleton_new ();
JobManager *job_manager;
GMainLoop *main_loop;
GError *error = NULL;
+ gchar *msg;
/* register the application and context in DLT */
DLT_REGISTER_APP ("BMGR", "GENIVI Boot Manager");
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL)
{
- g_warning ("Failed to connect to the system bus: %s", error->message);
+ msg = g_strdup_printf ("Failed to connect to the system bus: %s", error->message);
+ DLT_LOG (boot_manager_context, DLT_LOG_FATAL, DLT_STRING (msg));
+ g_free (msg);
/* clean up */
g_error_free (error);
NULL, &error);
if (systemd_manager == NULL)
{
- g_warning ("Failed to connect to the systemd manager: %s", error->message);
+ msg = g_strdup_printf ("Failed to connect to the systemd manager: %s",
+ error->message);
+ DLT_LOG (boot_manager_context, DLT_LOG_FATAL, DLT_STRING (msg));
+ g_free (msg);
/* clean up */
g_error_free (error);
/* subscribe to the systemd manager */
if (!systemd_manager_call_subscribe_sync (systemd_manager, NULL, &error))
{
- g_warning ("Failed to subscribe to the systemd manager: %s", error->message);
+ msg = g_strdup_printf ("Failed to subscribe to the systemd manager: %s",
+ error->message);
+ DLT_LOG (boot_manager_context, DLT_LOG_FATAL, DLT_STRING (msg));
+ g_free (msg);
/* clean up */
g_error_free (error);
/* instantiate the boot manager service implementation */
boot_manager_service = boot_manager_service_new (connection);
+ /* attempt to start the boot manager service */
+ if (!boot_manager_service_start_up (boot_manager_service, &error))
+ {
+ msg = g_strdup_printf ("Failed to start the boot manager service: %s",
+ error->message);
+ DLT_LOG (boot_manager_context, DLT_LOG_ERROR, DLT_STRING (msg));
+ g_free (msg);
+
+ /* clean up */
+ g_error_free (error);
+ g_object_unref (boot_manager_service);
+ g_object_unref (systemd_manager);
+ g_object_unref (connection);
+
+ return EXIT_FAILURE;
+ }
+
/* instantiate the job manager */
job_manager = job_manager_new (connection, systemd_manager);
- /* start up the target startup monitor */
- target_startup_monitor = target_startup_monitor_new (systemd_manager);
-
/* instantiate the legacy app handler */
la_handler_service = la_handler_service_new (connection, job_manager);
+ /* start the legacy app handler */
+ if (!la_handler_service_start (la_handler_service, &error))
+ {
+ msg = g_strdup_printf ("Failed to start the legacy app handler service: %s",
+ error->message);
+ DLT_LOG (boot_manager_context, DLT_LOG_ERROR, DLT_STRING (msg));
+ g_free (msg);
+
+ /* clean up */
+ g_clear_error (&error);
+ g_object_unref (la_handler_service);
+ g_object_unref (job_manager);
+ g_object_unref (boot_manager_service);
+ g_object_unref (systemd_manager);
+ g_object_unref (connection);
+
+ return EXIT_FAILURE;
+ }
+
/* create the main loop */
main_loop = g_main_loop_new (NULL, FALSE);
+ /* create the target startup monitor */
+ target_startup_monitor = target_startup_monitor_new (systemd_manager);
+
/* create and run the main application */
application = boot_manager_application_new (main_loop, connection, job_manager,
la_handler_service, boot_manager_service);