From fa50ad4a4b08f8edc7a974de7d41b175c232412b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 19 Feb 2013 13:24:30 +0000 Subject: [PATCH 1/3] Install systemd user units for a per-user bus When systemd gains support for activating a per-user systemd for each set of overlapping login sessions, this is what it'll use. The socket path used here, dbus/user_bus_socket, is what's assumed by systemd's user@.service and by user-session-units. This obsoletes the dbus.service, dbus.socket units found in user-session-units. --- bus/Makefile.am | 14 ++++++++++++-- bus/systemd-user/dbus.service.in | 10 ++++++++++ bus/systemd-user/dbus.socket.in | 9 +++++++++ configure.ac | 14 ++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 bus/systemd-user/dbus.service.in create mode 100644 bus/systemd-user/dbus.socket.in diff --git a/bus/Makefile.am b/bus/Makefile.am index 6cbc09a..7dbf287 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -277,16 +277,26 @@ bin_SCRIPTS= \ endif ## Cygwin end -if HAVE_SYSTEMD SCRIPT_IN_FILES += \ dbus.service.in \ - dbus.socket.in + dbus.socket.in \ + systemd-user/dbus.service.in \ + systemd-user/dbus.socket.in \ + $(NULL) +if HAVE_SYSTEMD systemdsystemunit_DATA = \ dbus.service \ dbus.socket endif +if HAVE_USER_SYSTEMD +systemduserunit_DATA = \ + systemd-user/dbus.service \ + systemd-user/dbus.socket \ + $(NULL) +endif + #### Extra dist EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) diff --git a/bus/systemd-user/dbus.service.in b/bus/systemd-user/dbus.service.in new file mode 100644 index 0000000..d02d598 --- /dev/null +++ b/bus/systemd-user/dbus.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=D-Bus User Message Bus +Requires=dbus.socket + +[Service] +ExecStart=@EXPANDED_BINDIR@/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation +ExecReload=@EXPANDED_BINDIR@/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig + +[Install] +Also=dbus.socket diff --git a/bus/systemd-user/dbus.socket.in b/bus/systemd-user/dbus.socket.in new file mode 100644 index 0000000..9e6f165 --- /dev/null +++ b/bus/systemd-user/dbus.socket.in @@ -0,0 +1,9 @@ +[Unit] +Description=D-Bus User Message Bus Socket + +[Socket] +ListenStream=%t/dbus/user_bus_socket + +[Install] +WantedBy=sockets.target +Also=dbus.service diff --git a/configure.ac b/configure.ac index 5c1a7e5..226ed9a 100644 --- a/configure.ac +++ b/configure.ac @@ -1550,6 +1550,18 @@ if test "x$with_systemdsystemunitdir" != xno; then fi AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) +AC_ARG_WITH([systemduserunitdir], +AS_HELP_STRING([--with-systemduserunitdir=DIR], [Directory for systemd user service files]), + [], + [ + PKG_CHECK_EXISTS([systemd], + [with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)], + [with_systemduserunitdir=no]) + ]) +AS_IF([test "x$with_systemduserunitdir" = x], [with_systemduserunitdir=no]) +AC_SUBST([systemduserunitdir], [$with_systemduserunitdir]) +AM_CONDITIONAL(HAVE_USER_SYSTEMD, [test "x$with_systemduserunitdir" != xno]) + ##### Set up location for system bus socket if ! test -z "$with_system_socket"; then DBUS_SYSTEM_SOCKET=$with_system_socket @@ -1806,6 +1818,8 @@ bus/org.freedesktop.dbus-session.plist bus/rc.messagebus bus/dbus.service bus/dbus.socket +bus/systemd-user/dbus.service +bus/systemd-user/dbus.socket Makefile dbus/Makefile bus/Makefile -- 1.7.10.4