bluez/0001-systemd-install-systemd-unit-files.patch

122 lines
3.6 KiB
Diff
Raw Normal View History

2011-08-01 22:38:07 +00:00
From 0080ce8a37152b0ee7750799e01de3bf810f8caf Mon Sep 17 00:00:00 2001
2010-09-14 12:53:54 +00:00
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 21 Jul 2010 19:20:44 +0200
Subject: [PATCH] systemd: install systemd unit files
2010-09-14 12:53:54 +00:00
This also enables bus activation for bluetoothd, but only if systemd is
running. Only if that's the case we can make sure in a race-free fashion
that bluetoothd is not started twice at the same time.
---
Makefile.am | 21 ++++++++++++++++++---
configure.ac | 9 +++++++++
scripts/.gitignore | 1 +
scripts/bluetooth.service.in | 13 +++++++++++++
2010-09-14 12:53:54 +00:00
scripts/org.bluez.service | 5 +++++
5 files changed, 46 insertions(+), 3 deletions(-)
2010-09-14 12:53:54 +00:00
create mode 100644 scripts/.gitignore
create mode 100644 scripts/bluetooth.service.in
create mode 100644 scripts/org.bluez.service
diff --git a/Makefile.am b/Makefile.am
2011-08-01 22:38:07 +00:00
index aecc8f2..6e18003 100644
2010-09-14 12:53:54 +00:00
--- a/Makefile.am
+++ b/Makefile.am
2011-08-01 22:38:07 +00:00
@@ -387,10 +387,25 @@ endif
2011-07-05 09:04:25 +00:00
rules_DATA = $(foreach file,$(udev_files), scripts/97-$(notdir $(file)))
2010-09-14 12:53:54 +00:00
endif
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ scripts/bluetooth.service
+
+scripts/bluetooth.service: scripts/bluetooth.service.in
+ @$(SED) -e "s|\@sbindir\@|$(sbindir)|" $< >$@
+
+dbussystemservicesdir = $(datadir)/dbus-1/system-services
+
+dbussystemservices_DATA = \
+ scripts/org.bluez.service
+
+endif
+
2011-07-05 09:04:25 +00:00
CLEANFILES += $(rules_DATA)
EXTRA_DIST += scripts/bluetooth.rules \
- scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules
+ scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules \
+ scripts/bluetooth.service.in scripts/org.bluez.service
2010-09-14 12:53:54 +00:00
EXTRA_DIST += doc/manager-api.txt \
doc/adapter-api.txt doc/device-api.txt \
2011-08-01 22:38:07 +00:00
@@ -417,9 +432,9 @@ pkgconfigdir = $(libdir)/pkgconfig
2010-09-14 12:53:54 +00:00
pkgconfig_DATA = bluez.pc
2011-07-05 09:04:25 +00:00
-DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles
+DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --with-systemdsystemunitdir=
2010-09-14 12:53:54 +00:00
-DISTCLEANFILES = $(pkgconfig_DATA)
+DISTCLEANFILES = $(pkgconfig_DATA) scripts/bluetooth.service
MAINTAINERCLEANFILES = Makefile.in \
aclocal.m4 configure config.h.in config.sub config.guess \
diff --git a/configure.ac b/configure.ac
2011-08-01 22:38:07 +00:00
index bc2658c..b4502ab 100644
2010-09-14 12:53:54 +00:00
--- a/configure.ac
+++ b/configure.ac
2011-07-05 09:04:25 +00:00
@@ -71,5 +71,14 @@ if (test -n "${path_systemdunit}"); then
2010-09-14 12:53:54 +00:00
fi
2011-07-05 09:04:25 +00:00
AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
2010-09-14 12:53:54 +00:00
+# systemd
+
+AC_ARG_WITH([systemdsystemunitdir],
2010-09-23 11:57:29 +00:00
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [],
+ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
2010-09-14 12:53:54 +00:00
+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
+
2010-10-27 18:04:10 +00:00
AC_OUTPUT(Makefile scripts/bluetooth.rules doc/version.xml
2011-07-05 09:04:25 +00:00
src/bluetoothd.8 src/bluetooth.service bluez.pc)
2010-09-14 12:53:54 +00:00
diff --git a/scripts/.gitignore b/scripts/.gitignore
new file mode 100644
index 0000000..4b9f765
--- /dev/null
+++ b/scripts/.gitignore
@@ -0,0 +1 @@
+bluetooth.service
diff --git a/scripts/bluetooth.service.in b/scripts/bluetooth.service.in
new file mode 100644
index 0000000..d0089ea
2010-09-14 12:53:54 +00:00
--- /dev/null
+++ b/scripts/bluetooth.service.in
@@ -0,0 +1,13 @@
2010-09-14 12:53:54 +00:00
+[Unit]
+Description=Bluetooth Manager
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=org.bluez
+ExecStart=@sbindir@/bluetoothd -n
+StandardOutput=syslog
+
+[Install]
+WantedBy=bluetooth.target
+Alias=dbus-org.bluez.service
2010-09-14 12:53:54 +00:00
diff --git a/scripts/org.bluez.service b/scripts/org.bluez.service
new file mode 100644
index 0000000..dd7ae8f
2010-09-14 12:53:54 +00:00
--- /dev/null
+++ b/scripts/org.bluez.service
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.bluez
+Exec=/bin/false
+User=root
+SystemdService=dbus-org.bluez.service
2010-09-14 12:53:54 +00:00
--
2011-08-01 22:38:07 +00:00
1.7.6
2010-09-14 12:53:54 +00:00