summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <gustavo.barbieri@intel.com>2014-03-09 23:55:42 -0300
committerGustavo Sverzut Barbieri <gustavo.barbieri@intel.com>2014-03-10 00:09:12 -0300
commitc52da37d0b83cf2159704ccc7f0583df6fac7da6 (patch)
treeb840f98de057a3f47a5e47907c418e8eb385ff3b
parent4be9526cc212bec3cdf7a708ee8d576c3d09e8a7 (diff)
link dbus and systemd services, allows systemd activation.
If the dbus service contains SystemdService entry and the dbus-daemon is started with --systemd-activation, then requests for services on the user session bus will be handled by systemd, creating cgroups and being handled as native systemd services of Type=dbus.
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac35
-rw-r--r--dbus-services/org.enlightenment.Efreet.service.in1
-rw-r--r--dbus-services/org.enlightenment.Ethumb.service.in1
-rw-r--r--m4/pkg_var.m414
-rw-r--r--systemd-services/.gitignore2
-rw-r--r--systemd-services/efreet.service.in7
-rw-r--r--systemd-services/ethumb.service.in7
8 files changed, 75 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 380b930fde..a2b70b5fff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,6 +32,7 @@ m4/ltsugar.m4 \
32m4/ltversion.m4 32m4/ltversion.m4
33 33
34EXTRA_DIST = \ 34EXTRA_DIST = \
35m4/pkg_var.m4 \
35m4/ac_path_generic.m4 \ 36m4/ac_path_generic.m4 \
36m4/ecore_check_c_extension.m4 \ 37m4/ecore_check_c_extension.m4 \
37m4/ecore_check_module.m4 \ 38m4/ecore_check_module.m4 \
@@ -309,6 +310,13 @@ service_DATA = \
309dbus-services/org.enlightenment.Efreet.service \ 310dbus-services/org.enlightenment.Efreet.service \
310dbus-services/org.enlightenment.Ethumb.service 311dbus-services/org.enlightenment.Ethumb.service
311 312
313if HAVE_SYSTEMD_USER_SESSION
314systemdunitsdir = @USER_SESSION_DIR@
315systemdunits_DATA = \
316systemd-services/efreet.service \
317systemd-services/ethumb.service
318endif
319EXTRA_DIST += $(systemdunits_DATA)
312 320
313 321
314.PHONY: doc benchmark examples install-examples 322.PHONY: doc benchmark examples install-examples
diff --git a/configure.ac b/configure.ac
index 754ad09b3f..d30d7220ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -587,6 +587,35 @@ AC_ARG_ENABLE([systemd],
587 want_systemd="no" 587 want_systemd="no"
588 ]) 588 ])
589 589
590systemd_dbus_prefix="# "
591if test "${want_systemd}" = "yes"; then
592 systemd_dbus_prefix=""
593fi
594AC_SUBST(systemd_dbus_prefix)
595
596AC_ARG_WITH([systemdunitdir],
597 AC_HELP_STRING([--with-systemdunitdir=DIR],
598 [path to systemd user services directory]),
599 [USER_SESSION_DIR=${withval}])
600if test "$want_systemd" == "no"; then
601 have_systemd_user_session="no"
602elif test -n "${USER_SESSION_DIR}"; then
603 have_systemd_user_session="yes"
604 AC_MSG_NOTICE([Using systemd user services directory as ${USER_SESSION_DIR}])
605else
606 # Detect systemd user session directory properly
607 EFL_PKG_CHECK_VAR([USER_SESSION_DIR], [systemd >= 192], [systemduserunitdir],
608 [have_systemd_user_session="yes"], [have_systemd_user_session="no"])
609
610 if test "$want_systemd" = "yes" -a "$have_systemd_user_session" = "no"; then
611 AC_MSG_ERROR([systemd support wanted, but systemd was not found.])
612 fi
613fi
614
615AM_CONDITIONAL([HAVE_SYSTEMD_USER_SESSION], [test "x${have_systemd_user_session}" = "xyes"])
616AC_SUBST([USER_SESSION_DIR])
617
618
590if test "x${have_systemd_pkg}" = "xauto" -o "x${have_systemd_pkg}" = "xyes"; then 619if test "x${have_systemd_pkg}" = "xauto" -o "x${have_systemd_pkg}" = "xyes"; then
591 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon >= 192 libsystemd-journal >= 192], 620 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon >= 192 libsystemd-journal >= 192],
592 [have_systemd_pkg="yes"], 621 [have_systemd_pkg="yes"],
@@ -4105,6 +4134,8 @@ pc/ethumb.pc
4105pc/ethumb_client.pc 4134pc/ethumb_client.pc
4106dbus-services/org.enlightenment.Efreet.service 4135dbus-services/org.enlightenment.Efreet.service
4107dbus-services/org.enlightenment.Ethumb.service 4136dbus-services/org.enlightenment.Ethumb.service
4137systemd-services/efreet.service
4138systemd-services/ethumb.service
4108$po_makefile_in 4139$po_makefile_in
4109cmakeconfig/EinaConfig.cmake 4140cmakeconfig/EinaConfig.cmake
4110cmakeconfig/EinaConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in 4141cmakeconfig/EinaConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
@@ -4250,6 +4281,10 @@ fi
4250echo " " 4281echo " "
4251echo "Installation....: make install (as root if needed, with 'su' or 'sudo')" 4282echo "Installation....: make install (as root if needed, with 'su' or 'sudo')"
4252echo " prefix........: $prefix" 4283echo " prefix........: $prefix"
4284echo " dbus units....: $dbusservicedir"
4285if test "${have_systemd_user_session}" = "yes"; then
4286echo " systemd units.: $USER_SESSION_DIR"
4287fi
4253echo 4288echo
4254 4289
4255if test "x${have_systemd_pkg}" = "xyes" -a "x${want_systemd}" = "xno"; then 4290if test "x${have_systemd_pkg}" = "xyes" -a "x${want_systemd}" = "xno"; then
diff --git a/dbus-services/org.enlightenment.Efreet.service.in b/dbus-services/org.enlightenment.Efreet.service.in
index 94eedc87e3..5eb5d5326b 100644
--- a/dbus-services/org.enlightenment.Efreet.service.in
+++ b/dbus-services/org.enlightenment.Efreet.service.in
@@ -1,3 +1,4 @@
1[D-BUS Service] 1[D-BUS Service]
2Name=org.enlightenment.Efreet 2Name=org.enlightenment.Efreet
3Exec=@prefix@/bin/efreetd 3Exec=@prefix@/bin/efreetd
4@systemd_dbus_prefix@SystemdService=efreet.service
diff --git a/dbus-services/org.enlightenment.Ethumb.service.in b/dbus-services/org.enlightenment.Ethumb.service.in
index ece2e031c4..484427f65c 100644
--- a/dbus-services/org.enlightenment.Ethumb.service.in
+++ b/dbus-services/org.enlightenment.Ethumb.service.in
@@ -1,3 +1,4 @@
1[D-BUS Service] 1[D-BUS Service]
2Name=org.enlightenment.Ethumb 2Name=org.enlightenment.Ethumb
3Exec=@prefix@/bin/ethumbd 3Exec=@prefix@/bin/ethumbd
4@systemd_dbus_prefix@SystemdService=ethumb.service
diff --git a/m4/pkg_var.m4 b/m4/pkg_var.m4
new file mode 100644
index 0000000000..3d0a309bcb
--- /dev/null
+++ b/m4/pkg_var.m4
@@ -0,0 +1,14 @@
1# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3# -------------------------------------------
4# Retrieves the value of the pkg-config variable for the given module.
5AC_DEFUN([EFL_PKG_CHECK_VAR],
6[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
7AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
8
9_PKG_CONFIG([$1], [variable="][$3]["], [$2])
10AS_VAR_COPY([$1], [pkg_cv_][$1])
11
12AS_VAR_IF([$1], [""], [$5], [$4])dnl
13])# PKG_CHECK_VAR
14
diff --git a/systemd-services/.gitignore b/systemd-services/.gitignore
new file mode 100644
index 0000000000..97355b6202
--- /dev/null
+++ b/systemd-services/.gitignore
@@ -0,0 +1,2 @@
1/efreet.service
2/ethumb.service
diff --git a/systemd-services/efreet.service.in b/systemd-services/efreet.service.in
new file mode 100644
index 0000000000..ee1becbfde
--- /dev/null
+++ b/systemd-services/efreet.service.in
@@ -0,0 +1,7 @@
1[Unit]
2Description=Efreet Enlightenment FreeDesktop.Org Daemon
3
4[Service]
5Type=dbus
6BusName=org.enlightenment.Efreet
7ExecStart=@prefix@/bin/efreetd
diff --git a/systemd-services/ethumb.service.in b/systemd-services/ethumb.service.in
new file mode 100644
index 0000000000..93bbff8bae
--- /dev/null
+++ b/systemd-services/ethumb.service.in
@@ -0,0 +1,7 @@
1[Unit]
2Description=Enlightenment Thumbnailer
3
4[Service]
5Type=dbus
6BusName=org.enlightenment.Ethumb
7ExecStart=@prefix@/bin/ethumbd