[PATCH] tools/mpris-proxy: Add systemd user unit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That way it will be started automatically which is convenient on phones.
Distributions can then decide part of which install the unit should be.

Signed-off-by: Guido Günther <agx@xxxxxxxxxxx>
---
 Makefile.am                  |  3 +++
 Makefile.obexd               |  3 +--
 Makefile.tools               |  3 +++
 configure.ac                 |  9 +++++++++
 tools/mpris-proxy.service.in | 13 +++++++++++++
 5 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 tools/mpris-proxy.service.in

diff --git a/Makefile.am b/Makefile.am
index 46a8cfb..976c272 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,6 +49,9 @@ if SYSTEMD
 systemdsystemunitdir = $(SYSTEMD_SYSTEMUNITDIR)
 systemdsystemunit_DATA = src/bluetooth.service
 
+systemduserunitdir = $(SYSTEMD_USERUNITDIR)
+systemduserunit_DATA =
+
 dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
 dbussystembus_DATA = src/org.bluez.service
 endif
diff --git a/Makefile.obexd b/Makefile.obexd
index b7e9f2d..4cdce73 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -2,8 +2,7 @@
 if OBEX
 
 if SYSTEMD
-systemduserunitdir = $(SYSTEMD_USERUNITDIR)
-systemduserunit_DATA = obexd/src/obex.service
+systemduserunit_DATA += obexd/src/obex.service
 
 dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
 dbussessionbus_DATA = obexd/src/org.bluez.obex.service
diff --git a/Makefile.tools b/Makefile.tools
index f4f9e82..dea399f 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -332,6 +332,9 @@ tools_hex2hcd_SOURCES = tools/hex2hcd.c
 
 tools_mpris_proxy_SOURCES = tools/mpris-proxy.c
 tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
+if SYSTEMD
+systemduserunit_DATA += tools/mpris-proxy.service
+endif
 
 tools_gatt_service_SOURCES = tools/gatt-service.c
 tools_gatt_service_LDADD = gdbus/libgdbus-internal.la \
diff --git a/configure.ac b/configure.ac
index d31eb16..6332645 100644
--- a/configure.ac
+++ b/configure.ac
@@ -428,6 +428,14 @@ fi
 #
 # Otherwise we'll end up with literal references in the final binaries or
 # manuals, which is not something we really want.
+#
+pkgbindir="${bindir}"
+if (test "$bindir" = '${exec_prefix}/bin'); then
+	pkgbindir="${exec_prefix}/bin"
+else
+	pkgbindir="${bindir}"
+fi
+AC_SUBST(PKGBINDIR, "${pkgbindir}")
 
 if (test "$libexecdir" = '${exec_prefix}/libexec'); then
 	pkglibexecdir="${exec_prefix}/libexec/bluetooth"
@@ -496,5 +504,6 @@ AC_CONFIG_FILES(
 	src/bluetoothd.rst
 	src/bluetooth.service
 	tools/bluetooth-logger.service
+	tools/mpris-proxy.service
 )
 AC_OUTPUT
diff --git a/tools/mpris-proxy.service.in b/tools/mpris-proxy.service.in
new file mode 100644
index 0000000..5307490
--- /dev/null
+++ b/tools/mpris-proxy.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=Bluetooth mpris proxy
+Documentation=man:mpris-proxy(1)
+
+Wants=dbus.socket
+After=dbus.socket
+
+[Service]
+Type=simple
+ExecStart=@PKGBINDIR@/mpris-proxy
+
+[Install]
+WantedBy=default.target
-- 
2.45.2





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux