Support for invoking messageport daemon by systemd with correct smack label.
This commit is also having the supported changes :
- Stop using session bus for invoking, and fix tests in non-session-bus case.
- change in daemon socket location : /run/user/@usern_name@ -> /tmp.
As user specific folder is not created at the time of daemon startup
Change-Id: Ibd885e522970aa63241792258e4a32a0bf32cfbb
AC_SUBST(DLOG_LIBS)
AC_DEFINE(MESSAGEPORT_BUS_ADDRESS,
- ["unix:path=%s/.message-port", g_get_user_runtime_dir()],
+ ["unix:path=%s/.message-port", "/tmp"],
[messageport daemon server socket address])
# Use Session bus for daemon activation
daemon/Makefile
lib/Makefile
lib/message-port.pc
+messageportd.service
])
if test "x$enable_sessionbus" = "xyes"; then
--- /dev/null
+[Unit]
+Description=Messageport Daemon
+
+[Service]
+Type=simple
+User=app
+SmackExecLabel=User
+KillSignal=SIGTERM
+Restart=always
+ExecStart=@prefix@/bin/messageportd
+
+[Install]
+WantedBy=multi-user.target
%define build_tests 1
-%define use_session_bus 1
+%define use_session_bus 0
+%define systemddir /lib/systemd
+
Name: message-port
Summary: Message port daemon
Version: 1.0.0
%install
%make_install
+mkdir -p ${RPM_BUILD_ROOT}%{systemddir}/system
+cp messageportd.service $RPM_BUILD_ROOT%{systemddir}/system
+
+%post
+/bin/systemctl enable messageportd.service
+
+%postun
+/bin/systemctl disable messageportd.service
%post -n lib%{name}
/sbin/ldconfig
%{_datadir}/dbus-1/services/org.tizen.messageport.service
%manifest %{name}.manifest
%endif
-
+%{systemddir}/system/messageportd.service
# libmessage-port
%files -n lib%{name}
static gboolean
test_setup ()
{
+#ifdef USE_SESSION_BUS
GIOChannel *channel = NULL;
gchar *bus_address = NULL;
gint tmp_fd = 0;
g_print ("Dbus daemon start at : %s\n", bus_address);
g_free (bus_address);
+#endif /* USE_SESSION_BUS */
return TRUE;
}
static void
test_cleanup ()
{
+#ifdef USE_SESSION_BUS
if (__daemon_pid) kill (__daemon_pid, SIGTERM);
+#endif /* USE_SESSION_BUS */
}
static bool
test_setup ()
{
+#ifdef USE_SESSION_BUS
GIOChannel *channel = NULL;
gchar *bus_address = NULL;
gint tmp_fd = 0;
setenv("DBUS_SESSION_BUS_ADDRESS", bus_address, TRUE);
g_free (bus_address);
+#endif /* USE_SESSION_BUS */
return true;
}
static void
test_cleanup ()
{
+#ifdef USE_SESSION_BUS
if (__daemon_pid) kill (__daemon_pid, SIGTERM);
+#endif /* USE_SESSION_BUS */
}
int main (int argc, const char *argv[])