SUBDIRS = \
common \
boot-manager \
+ legacy-app-handler \
nsm-dummy \
tests
boot_manager_built_headers = \
boot-manager-dbus.h \
- la-handler-dbus.h \
systemd-manager-dbus.h
boot_manager_built_sources = \
boot-manager-dbus.c \
- la-handler-dbus.c \
systemd-manager-dbus.c \
$(boot_manager_built_headers)
boot_manager_SOURCES = \
boot-manager-application.c \
boot-manager-application.h \
- boot-manager-command-line.c \
- boot-manager-command-line.h \
boot-manager-service.c \
boot-manager-service.h \
glib-extensions.c \
EXTRA_DIST = \
boot-manager-dbus.xml \
- la-handler-dbus.xml \
systemd-manager-dbus.xml \
$(dbus_service_in_files) \
$(systemd_service_in_files)
--annotate org.genivi.BootManager1.BootManager org.gtk.GDBus.C.Name \
Boot_Manager $<
-la-handler-dbus.h: la-handler-dbus.xml Makefile
- $(AM_V_GEN) $(GDBUS_CODEGEN) \
- --interface-prefix org.genivi \
- --c-namespace "" \
- --generate-c-code la-handler-dbus \
- --annotate org.genivi.BootManager1.LegacyAppHandler org.gtk.GDBus.C.Name \
- LA_Handler $<
-
systemd-manager-dbus.h: systemd-manager-dbus.xml Makefile
$(AM_V_GEN) $(GDBUS_CODEGEN) \
--interface-prefix org.freedesktop.systemd1 \
+++ /dev/null
-/* vi:set et ai sw=2 sts=2 ts=2: */
-/* -
- * Copyright (c) 2012 GENIVI.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <glib.h>
-#include <gio/gio.h>
-
-#include <dlt/dlt.h>
-
-#include <boot-manager/boot-manager-command-line.h>
-#include <boot-manager/la-handler-dbus.h>
-
-
-DLT_IMPORT_CONTEXT (la_handler_context);
-
-
-
-gint
-boot_manager_handle_command_line (int argc,
- char **argv,
- GDBusConnection *connection)
-{
- GOptionContext *context = g_option_context_new (NULL);
- LAHandler *legacy_app_handler = NULL;
- gboolean do_register = FALSE;
- gboolean do_deregister = FALSE;
- GError *error = NULL;
- gchar *unit = NULL;
- gchar *log_message = NULL;
- gchar *mode = NULL;
- gint timeout = 0;
- int exit_status;
-
- GOptionEntry entries[] = {
- {"deregister", 0, 0, G_OPTION_ARG_NONE, &do_deregister, NULL, NULL},
- {"register", 0, 0, G_OPTION_ARG_NONE, &do_register, NULL, NULL},
- {"unit", 0, 0, G_OPTION_ARG_STRING, &unit, NULL, NULL},
- {"timeout", 0, 0, G_OPTION_ARG_INT, &timeout, NULL, NULL},
- {"shutdown-mode", 0, 0, G_OPTION_ARG_STRING, &mode, NULL, NULL},
- {NULL},
- };
-
- /* set up the option context */
- g_option_context_set_help_enabled (context, FALSE);
- g_option_context_add_main_entries (context, entries, NULL);
-
- /* parse the arguments into argument data */
- if (!g_option_context_parse (context, &argc, &argv, &error) || error != NULL)
- {
- /* an error occurred */
- log_message =
- g_strdup_printf ("Error occurred parsing arguments: %s\n", error->message);
- DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (log_message));
-
- exit_status = EXIT_FAILURE;
- goto finish;
- }
-
- /* validate the argument data */
- if (unit == NULL || *unit == '\0')
- {
- DLT_LOG (la_handler_context, DLT_LOG_ERROR,
- DLT_STRING ("Invalid arguments: unit must be defined"));
- exit_status = EXIT_FAILURE;
- goto finish;
- }
-
- if (!(do_register ^ do_deregister))
- {
- DLT_LOG (la_handler_context, DLT_LOG_ERROR,
- DLT_STRING ("Invalid arguments: Please select either --register or "
- "--deregister"));
- exit_status = EXIT_FAILURE;
- goto finish;
- }
-
- if (do_register && timeout < 0)
- {
- DLT_LOG (la_handler_context, DLT_LOG_ERROR,
- DLT_STRING ("Invalid arguments: Timeout must be non-negative"));
- exit_status = EXIT_FAILURE;
- goto finish;
- }
-
- /* get a legacy app handler interface */
- legacy_app_handler =
- la_handler_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE,
- "org.genivi.BootManager1",
- "/org/genivi/BootManager1/LegacyAppHandler", NULL,
- &error);
- if (error != NULL)
- {
- /* failed to connect to the legacy app handler */
- log_message =
- g_strdup_printf ("Error occurred connecting to legacy app handler "
- "interface: %s", error->message);
- DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (log_message));
-
- g_free (log_message);
- g_error_free (error);
-
- exit_status = EXIT_FAILURE;
- goto finish;
- }
-
- if (do_register)
- {
- /* call the legacy app handler's Register() method */
- la_handler_call_register_sync (legacy_app_handler, unit, mode ? mode : "normal",
- (guint) timeout, NULL, &error);
-
- if (error != NULL)
- {
- /* failed to register the legacy app */
- log_message = g_strdup_printf ("Error occurred registering legacy app: %s",
- error->message);
- DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (log_message));
-
- exit_status = EXIT_FAILURE;
- }
- else
- {
- exit_status = EXIT_SUCCESS;
- }
- goto finish;
- }
- else if (do_deregister)
- {
- /* call the legacy app handler's Deregister() method */
- la_handler_call_deregister_sync (legacy_app_handler, unit, NULL, &error);
- if (error != NULL)
- {
- /* failed to deregister the legacy app */
- log_message = g_strdup_printf ("Error occurred deregistering legacy app: %s",
- error->message);
- DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (log_message));
-
- exit_status = EXIT_FAILURE;
- }
- else
- {
- exit_status = EXIT_SUCCESS;
- }
- goto finish;
- }
- else
- {
- DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING ("unexpected input"));
- exit_status = EXIT_FAILURE;
- goto finish;
- }
-
- finish:
- g_option_context_free (context);
- if (legacy_app_handler != NULL)
- g_object_unref (legacy_app_handler);
- if (error != NULL)
- g_error_free (error);
- g_free (unit);
- g_free (log_message);
- g_free (mode);
- return exit_status;
-}
+++ /dev/null
-/* vi:set et ai sw=2 sts=2 ts=2: */
-/* -
- * Copyright (c) 2012 GENIVI.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <glib.h>
-#include <gio/gio.h>
-
-gint boot_manager_handle_command_line (int argc,
- char **argv,
- GDBusConnection *connection);
#include <dlt/dlt.h>
+#include <common/la-handler-dbus.h>
#include <common/nsm-consumer-dbus.h>
+#include <common/nsm-enum-types.h>
#include <common/shutdown-consumer-dbus.h>
#include <boot-manager/job-manager.h>
-#include <boot-manager/la-handler-dbus.h>
#include <boot-manager/la-handler-service.h>
static gboolean la_handler_service_handle_register (LAHandler *interface,
GDBusMethodInvocation *invocation,
const gchar *unit,
- const gchar *mode,
+ NSMShutdownType mode,
guint timeout,
LAHandlerService *service);
static void la_handler_service_handle_register_finish (GObject *object,
la_handler_service_handle_register (LAHandler *interface,
GDBusMethodInvocation *invocation,
const gchar *unit,
- const gchar *mode,
+ NSMShutdownType mode,
guint timeout,
LAHandlerService *service)
{
g_return_val_if_fail (IS_LA_HANDLER (interface), FALSE);
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), FALSE);
g_return_val_if_fail (unit != NULL && *unit != '\0', FALSE);
- g_return_val_if_fail (mode != NULL && *mode != '\0', FALSE);
g_return_val_if_fail (LA_HANDLER_IS_SERVICE (service), FALSE);
/* find out if this unit is already registered with a shutdown consumer */
service->connection, object_path, &error);
if (error != NULL)
{
- log_text =
- g_strdup_printf ("Failed to export shutdown consumer on the bus: %s",
- error->message);
+ log_text = g_strdup_printf ("Failed to export shutdown consumer on the bus: %s",
+ error->message);
DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (log_text));
g_free (log_text);
g_error_free (error);
/* register the shutdown consumer with the NSM Consumer */
nsm_consumer_call_register_shutdown_client (service->nsm_consumer,
- "org.genivi.BootManager1", object_path, 0,
- timeout, NULL,
+ "org.genivi.BootManager1", object_path,
+ mode, timeout, NULL,
la_handler_service_handle_register_finish,
invocation);
#include <dlt/dlt.h>
#include <boot-manager/boot-manager-application.h>
-#include <boot-manager/boot-manager-command-line.h>
#include <boot-manager/boot-manager-dbus.h>
#include <boot-manager/boot-manager-service.h>
#include <boot-manager/la-handler-service.h>
JobManager *job_manager;
GMainLoop *main_loop;
GError *error = NULL;
- gint exit_status;
/* register the application and context in DLT */
DLT_REGISTER_APP ("BMGR", "GENIVI Boot Manager");
return EXIT_FAILURE;
}
- /* Parse and react to the command-line arguments instead of starting the application
- * if any arguments are given */
- if (argc > 1)
- {
- exit_status = boot_manager_handle_command_line (argc, argv, connection);
- g_object_unref (connection);
- return exit_status;
- }
-
/* attempt to connect to the systemd manager */
systemd_manager =
systemd_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
noinst_LTLIBRARIES = libcommon.la
libcommon_la_built_headers = \
+ la-handler-dbus.h \
nsm-consumer-dbus.h \
nsm-lifecycle-control-dbus.h \
shutdown-consumer-dbus.h
libcommon_la_built_sources = \
+ la-handler-dbus.c \
nsm-consumer-dbus.c \
nsm-lifecycle-control-dbus.c \
shutdown-consumer-dbus.c \
$(SYSTEMD_DAEMON_LIBS)
EXTRA_DIST = \
+ la-handler-dbus.xml \
nsm-consumer-dbus.xml \
nsm-lifecycle-control-dbus.xml \
shutdown-consumer-dbus.xml
BUILT_SOURCES = \
$(libcommon_la_built_headers)
+la-handler-dbus.h: la-handler-dbus.xml Makefile
+ $(AM_V_GEN) $(GDBUS_CODEGEN) \
+ --interface-prefix org.genivi \
+ --c-namespace "" \
+ --generate-c-code la-handler-dbus \
+ --annotate org.genivi.BootManager1.LegacyAppHandler org.gtk.GDBus.C.Name \
+ LA_Handler $<
+
nsm-consumer-dbus.h: nsm-consumer-dbus.xml Makefile
- $(AM_V_GEN) $(GDBUS_CODEGEN) \
- --interface-prefix com.contiautomotive.NodeStateManager \
- --c-namespace "" \
- --generate-c-code nsm-consumer-dbus \
- --annotate com.contiautomotive.NodeStateManager.Consumer org.gtk.GDBus.C.Name \
- NSM_Consumer $<
+ $(AM_V_GEN) $(GDBUS_CODEGEN) \
+ --interface-prefix com.contiautomotive.NodeStateManager \
+ --c-namespace "" \
+ --generate-c-code nsm-consumer-dbus \
+ --annotate com.contiautomotive.NodeStateManager.Consumer \
+ org.gtk.GDBus.C.Name NSM_Consumer $<
nsm-lifecycle-control-dbus.h: nsm-lifecycle-control-dbus.xml Makefile
- $(AM_V_GEN) $(GDBUS_CODEGEN) \
- --interface-prefix com.contiautomotive.NodeStateManager \
- --c-namespace "" \
- --generate-c-code nsm-lifecycle-control-dbus \
- --annotate com.contiautomotive.NodeStateManager.LifecycleControl org.gtk.GDBus.C.Name \
- NSM_Lifecycle_Control $<
+ $(AM_V_GEN) $(GDBUS_CODEGEN) \
+ --interface-prefix com.contiautomotive.NodeStateManager \
+ --c-namespace "" \
+ --generate-c-code nsm-lifecycle-control-dbus \
+ --annotate com.contiautomotive.NodeStateManager.LifecycleControl \
+ org.gtk.GDBus.C.Name NSM_Lifecycle_Control $<
shutdown-consumer-dbus.h: shutdown-consumer-dbus.xml Makefile
$(AM_V_GEN) $(GDBUS_CODEGEN) \
--interface-prefix org.genivi \
--c-namespace "" \
--generate-c-code shutdown-consumer-dbus \
- --annotate com.contiautomotive.NodeStateManager.LifeCycleConsumer org.gtk.GDBus.C.Name \
- Shutdown_Consumer $<
+ --annotate com.contiautomotive.NodeStateManager.LifeCycleConsumer \
+ org.gtk.GDBus.C.Name Shutdown_Consumer $<
<method name="Register">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<arg name="unit" type="s" direction="in"/>
- <arg name="mode" type="s" direction="in"/>
+ <arg name="mode" type="i" direction="in"/>
<arg name="timeout" type="u" direction="in"/>
</method>
-
- <!--
- Deregister:
- @unit: An application unit filename.
-
- Removes the shutdown consumer for an app from the NSM.
- -->
- <method name="Deregister">
- <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
- <arg name="unit" type="s" direction="in"/>
- </method>
</interface>
</node>
common/Makefile
boot-manager/busconf/Makefile
boot-manager/Makefile
+legacy-app-handler/Makefile
nsm-dummy/busconf/Makefile
nsm-dummy/dbus/Makefile
nsm-dummy/systemd/Makefile
--- /dev/null
+# vi:set ts=8 sw=8 noet ai nocindent:
+
+legacy_app_handlerdir = \
+ $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
+
+legacy_app_handler_PROGRAMS = \
+ legacy-app-handler
+
+legacy_app_handler_SOURCES = \
+ main.c
+
+legacy_app_handler_CFLAGS = \
+ -DG_LOG_DOMAIN=\"legacy-app-handler\" \
+ -I$(top_srcdir) \
+ $(DLT_CFLAGS) \
+ $(GIO_CFLAGS) \
+ $(GIO_UNIX_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(PLATFORM_CFLAGS) \
+ $(PLATFORM_CPPFLAGS)
+
+legacy_app_handler_LDFLAGS = \
+ -no-undefined \
+ $(PLATFORM_LDFLAGS)
+
+legacy_app_handler_DEPENDENCIES = \
+ $(top_builddir)/common/libcommon.la
+
+legacy_app_handler_LDADD = \
+ $(DLT_LIBS) \
+ $(GIO_LIBS) \
+ $(GIO_UNIX_LIBS) \
+ $(GLIB_LIBS) \
+ $(top_builddir)/common/libcommon.la
--- /dev/null
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/* -
+ * Copyright (c) 2012 GENIVI.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <dlt/dlt.h>
+
+#include <common/la-handler-dbus.h>
+#include <common/nsm-enum-types.h>
+
+
+
+static gchar *unit = NULL;
+static gint timeout = 0;
+static gchar *shutdown_mode = NULL;
+
+
+
+static GOptionEntry entries[] =
+{
+ { "unit", 'u', 0, G_OPTION_ARG_STRING, &unit, "Legacy application unit", NULL },
+ { "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "Shutdown timeout in seconds", NULL },
+ { "shutdown-mode", 'm', 0, G_OPTION_ARG_STRING, &shutdown_mode, "Shutdown mode (none, normal, fast)", NULL },
+ { NULL },
+};
+
+
+
+DLT_DECLARE_CONTEXT (la_handler_context);
+
+
+
+static void
+unregister_dlt (void)
+{
+ DLT_UNREGISTER_CONTEXT (la_handler_context);
+ DLT_UNREGISTER_APP ();
+}
+
+
+
+static gboolean
+translate_shutdown_mode (const gchar *str,
+ NSMShutdownType *mode)
+{
+ g_return_val_if_fail (mode != NULL, FALSE);
+
+ /* try parsing the shutdown mode option into the NSMShutdownType enum */
+ if (g_strcmp0 (str, "none") == 0)
+ {
+ *mode = NSM_SHUTDOWN_TYPE_NOT;
+ return TRUE;
+ }
+ else if (g_strcmp0 (str, "normal") == 0)
+ {
+ *mode = NSM_SHUTDOWN_TYPE_NORMAL;
+ return TRUE;
+ }
+ else if (g_strcmp0 (str, "fast") == 0)
+ {
+ *mode = NSM_SHUTDOWN_TYPE_FAST;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
+int
+main (int argc,
+ char **argv)
+{
+ GOptionContext *context;
+ NSMShutdownType real_shutdown_mode;
+ LAHandler *service;
+ GError *error = NULL;
+ gchar *msg;
+
+ /* register the application and context with the DLT */
+ DLT_REGISTER_APP ("BMGR", "GENIVI Boot Manager");
+ DLT_REGISTER_CONTEXT (la_handler_context, "LAH", "Legacy Application Handler");
+
+ /* make sure to unregister the DLT at exit */
+ atexit (unregister_dlt);
+
+ /* initialize the GType type system */
+ g_type_init ();
+
+ /* prepare command line option parsing */
+ context = g_option_context_new (NULL);
+ g_option_context_set_help_enabled (context, TRUE);
+ g_option_context_add_main_entries (context, entries, NULL);
+
+ /* try to parse command line options */
+ if (!g_option_context_parse (context, &argc, &argv, &error))
+ {
+ /* parsing failed, exit with an error */
+ msg = g_strdup_printf ("Failed to parse command line options: %s\n",
+ error->message);
+ DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (msg));
+ g_free (msg);
+
+ /* clean up */
+ g_option_context_free (context);
+ g_error_free (error);
+ g_free (unit);
+ g_free (shutdown_mode);
+
+ return EXIT_FAILURE;
+ }
+ g_option_context_free (context);
+
+ /* abort if no unit file was specified */
+ if (unit == NULL || *unit == '\0')
+ {
+ DLT_LOG (la_handler_context, DLT_LOG_ERROR,
+ DLT_STRING ("Failed to register legacy application: no unit specified"));
+
+ /* free command line options */
+ g_free (unit);
+ g_free (shutdown_mode);
+
+ return EXIT_FAILURE;
+ }
+
+ /* validate the shutdown mode */
+ if (!translate_shutdown_mode (shutdown_mode, &real_shutdown_mode))
+ {
+ msg = g_strdup_printf ("Failed to register legacy application: "
+ "invalid shutdown mode \"%s\"", shutdown_mode);
+ DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (msg));
+ g_free (msg);
+
+ /* free command line options */
+ g_free (unit);
+ g_free (shutdown_mode);
+
+ return EXIT_FAILURE;
+ }
+
+ /* validate the timeout */
+ if (timeout < 0)
+ {
+ DLT_LOG (la_handler_context, DLT_LOG_ERROR,
+ DLT_STRING ("Failed to register legacy application: "
+ "shutdown timeout must be non-negative"));
+
+ /* free command line options */
+ g_free (unit);
+ g_free (shutdown_mode);
+
+ return EXIT_FAILURE;
+ }
+
+ /* create a proxy to talk to the legacy app handler D-Bus service */
+ service =
+ la_handler_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.genivi.BootManager1",
+ "/org/genivi/BootManager1/LegacyAppHandler",
+ NULL, &error);
+
+ /* abort if the proxy could not be created */
+ if (service == NULL)
+ {
+ msg = g_strdup_printf ("Failed to register legacy application: %s", error->message);
+ DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (msg));
+ g_free (msg);
+
+ /* clean up */
+ g_error_free (error);
+
+ /* free command line options */
+ g_free (unit);
+ g_free (shutdown_mode);
+
+ return EXIT_FAILURE;
+ }
+
+ /* forward the register request to the legacy app handler D-Bus service */
+ if (!la_handler_call_register_sync (service, unit, real_shutdown_mode, timeout,
+ NULL, &error))
+ {
+ msg = g_strdup_printf ("Failed to register legacy application: %s", error->message);
+ DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (msg));
+ g_free (msg);
+
+ /* clean up */
+ g_error_free (error);
+ g_object_unref (service);
+
+ /* free command line options */
+ g_free (unit);
+ g_free (shutdown_mode);
+
+ return EXIT_FAILURE;
+ }
+
+ /* release the legacy app handler proxy */
+ g_object_unref (service);
+
+ /* free command line options */
+ g_free (unit);
+ g_free (shutdown_mode);
+
+ return EXIT_SUCCESS;
+}
systemd
nsm_dummydir = \
- $(libdir)/nsm-dummy-$(BOOT_MANAGER_VERSION_API)
+ $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
-nsm_dummy_PROGRAMS = \
+nsm_dummy_PROGRAMS = \
nsm-dummy
-nsm_dummy_SOURCES = \
- nsm-consumer-service.c \
- nsm-consumer-service.h \
- nsm-dummy-application.c \
- nsm-dummy-application.h \
- nsm-lifecycle-control-service.c \
- nsm-lifecycle-control-service.h \
+nsm_dummy_SOURCES = \
+ nsm-consumer-service.c \
+ nsm-consumer-service.h \
+ nsm-dummy-application.c \
+ nsm-dummy-application.h \
+ nsm-lifecycle-control-service.c \
+ nsm-lifecycle-control-service.h \
main.c
-nsm_dummy_CFLAGS = \
- -DG_LOG_DOMAIN=\"nsm-dummy\" \
- -I$(top_srcdir) \
- $(DLT_CFLAGS) \
- $(GIO_CFLAGS) \
- $(GIO_UNIX_CFLAGS) \
- $(GLIB_CFLAGS) \
- $(PLATFORM_CFLAGS) \
- $(PLATFORM_CPPFLAGS) \
+nsm_dummy_CFLAGS = \
+ -DG_LOG_DOMAIN=\"nsm-dummy\" \
+ -I$(top_srcdir) \
+ $(DLT_CFLAGS) \
+ $(GIO_CFLAGS) \
+ $(GIO_UNIX_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(PLATFORM_CFLAGS) \
+ $(PLATFORM_CPPFLAGS) \
$(SYSTEMD_DAEMON_CFLAGS)
-nsm_dummy_LDFLAGS = \
- -no-undefined \
+nsm_dummy_LDFLAGS = \
+ -no-undefined \
$(PLATFORM_LDFLAGS)
-nsm_dummy_DEPENDENCIES = \
+nsm_dummy_DEPENDENCIES = \
$(top_builddir)/common/libcommon.la
-nsm_dummy_LDADD = \
- $(DLT_LIBS) \
- $(GIO_LIBS) \
- $(GIO_UNIX_LIBS) \
- $(GLIB_LIBS) \
- $(SYSTEMD_DAEMON_LIBS) \
+nsm_dummy_LDADD = \
+ $(DLT_LIBS) \
+ $(GIO_LIBS) \
+ $(GIO_UNIX_LIBS) \
+ $(GLIB_LIBS) \
+ $(SYSTEMD_DAEMON_LIBS) \
$(top_builddir)/common/libcommon.la
[D-BUS Service]
Name=com.contiautomotive.NodeStateManager
SystemdService = nsm-dummy.service
-Exec=@libdir@/nsm-dummy-@BOOT_MANAGER_VERSION_API@/nsm-dummy
+Exec=@libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/nsm-dummy
[D-BUS Service]
Name=com.contiautomotive.NodeStateManager
SystemdService = nsm-dummy.service
-Exec=@libdir@/nsm-dummy-@BOOT_MANAGER_VERSION_API@/nsm-dummy
+Exec=@libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/nsm-dummy
[Service]
Type = dbus
BusName = com.contiautomotive.NodeStateManager
-ExecStart = @libdir@/nsm-dummy-@BOOT_MANAGER_VERSION_API@/nsm-dummy
+ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/nsm-dummy
# vi:set ts=8 sw=8 noet ai nocindent:
-testscriptdir = /usr/bin
+testscriptdir = $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
testscript_DATA = \
- org-genivi-LegacyAppHandler1-test-service.py
+ legacy-app-handler-test
-testconfdir = /etc/dbus-1/system.d
+testconfdir = $(sysconfdir)/dbus-1/system.d
testconf_DATA = \
- org.genivi.LegacyAppHandler1.test.conf
+ legacy-app-handler-test.conf
-servicedir = /lib/systemd/system
+servicedir = $(libdir)/systemd/system
service_in_files = \
- org.genivi.LegacyAppHandler1.test1.service.in \
- org.genivi.LegacyAppHandler1.test2.service.in \
- org.genivi.LegacyAppHandler1.test3.service.in
+ legacy-app-handler-test1.service.in \
+ legacy-app-handler-test2.service.in \
+ legacy-app-handler-test3.service.in
service_DATA = $(service_in_files:.service.in=.service)
-e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
CLEANFILES = \
- $(service_DATA) \
- $(testconf_DATA) \
- $(testscript_DATA)
+ $(service_DATA)
EXTRA_DIST = \
$(service_in_files) \
--- /dev/null
+#!/usr/bin/python
+
+import gobject
+import dbus
+import dbus.service
+import sys
+
+from dbus.mainloop.glib import DBusGMainLoop
+
+
+class TestService(dbus.service.Object):
+
+ def __init__(self, name):
+ bus_name = dbus.service.BusName(
+ 'org.genivi.BootManager1.LegacyAppHandler.%s' % name,
+ bus=dbus.SystemBus())
+ object_path = '/org/genivi/BootManager1/LegacyAppHandler/%s' % name
+ dbus.service.Object.__init__(self, bus_name, object_path)
+
+ @dbus.service.method('org.genivi.BootManager1.LegacyAppHandler.Test')
+ def hello(self):
+ return "Hello World!"
+
+
+if __name__ == '__main__':
+ DBusGMainLoop(set_as_default=True)
+ service = TestService(sys.argv[1])
+ loop = gobject.MainLoop()
+ loop.run()
--- /dev/null
+[Service]
+ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler-test Test1
+ExecStartPost = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
+ --register --unit=legacy-app-handler-test1.service
--- /dev/null
+[Service]
+ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler-test Test2
+ExecStartPost = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
+ --register --unit=legacy-app-handler-test2.service
--- /dev/null
+[Service]
+ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler-test Test3
+ExecStartPost = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
+ --register --unit=legacy-app-handler-test3.service
+++ /dev/null
-#!/usr/bin/python
-import gobject
-import dbus
-import dbus.service
-import sys
-from dbus.mainloop.glib import DBusGMainLoop
-
-class TestService (dbus.service.Object):
- def __init__(self):
- bus_name = dbus.service.BusName(sys.argv[1], bus=dbus.SystemBus())
- dbus.service.Object.__init__(self, bus_name, '/org/genivi/LegacyAppHandler1/test1')
-
- @dbus.service.method('org.genivi.LegacyAppHandler1.test1')
- def hello(self):
- return "Hello World!"
-
-DBusGMainLoop(set_as_default=True)
-myservice = TestService()
-loop = gobject.MainLoop()
-loop.run()
+++ /dev/null
-[Service]
-ExecStart = /usr/bin/python /usr/bin/org-genivi-LegacyAppHandler1-test-service.py \
- org.genivi.LegacyAppHandler1.test1
-ExecStartPost = @libdir@/legacy-app-handler-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
- --register --unit="org.genivi.LegacyAppHandler1.test1.service"
+++ /dev/null
-[Service]
-ExecStart = /usr/bin/python /usr/bin/org-genivi-LegacyAppHandler1-test-service.py \
- org.genivi.LegacyAppHandler1.test2
-ExecStartPost = @libdir@/legacy-app-handler-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
- --register --unit="org.genivi.LegacyAppHandler1.test2.service"
+++ /dev/null
-[Service]
-ExecStart = /usr/bin/python /usr/bin/org-genivi-LegacyAppHandler1-test-service.py \
- org.genivi.LegacyAppHandler1.test3
-ExecStartPost = @libdir@/legacy-app-handler-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
- --register --unit="org.genivi.LegacyAppHandler1.test3.service"