]> git.pld-linux.org Git - packages/bluez.git/blame - bluez-systemd.patch
- rel 4
[packages/bluez.git] / bluez-systemd.patch
CommitLineData
7fec19c2
BZ
1From 0080ce8a37152b0ee7750799e01de3bf810f8caf Mon Sep 17 00:00:00 2001
2From: Lennart Poettering <lennart@poettering.net>
3Date: Wed, 21 Jul 2010 19:20:44 +0200
4Subject: [PATCH] systemd: install systemd unit files
5
6This also enables bus activation for bluetoothd, but only if systemd is
7running. Only if that's the case we can make sure in a race-free fashion
8that bluetoothd is not started twice at the same time.
9---
10 Makefile.am | 21 ++++++++++++++++++---
11 configure.ac | 9 +++++++++
12 scripts/.gitignore | 1 +
13 scripts/bluetooth.service.in | 13 +++++++++++++
14 scripts/org.bluez.service | 5 +++++
15 5 files changed, 46 insertions(+), 3 deletions(-)
16 create mode 100644 scripts/.gitignore
17 create mode 100644 scripts/bluetooth.service.in
18 create mode 100644 scripts/org.bluez.service
19
20diff --git a/Makefile.am b/Makefile.am
21index aecc8f2..6e18003 100644
22--- a/Makefile.am
23+++ b/Makefile.am
24@@ -387,10 +387,25 @@ endif
25 rules_DATA = $(foreach file,$(udev_files), scripts/97-$(notdir $(file)))
26 endif
27
28+if HAVE_SYSTEMD
29+systemdsystemunit_DATA = \
30+ scripts/bluetooth.service
31+
32+scripts/bluetooth.service: scripts/bluetooth.service.in
33+ @$(SED) -e "s|\@sbindir\@|$(sbindir)|" $< >$@
34+
35+dbussystemservicesdir = $(datadir)/dbus-1/system-services
36+
37+dbussystemservices_DATA = \
38+ scripts/org.bluez.service
39+
40+endif
41+
42 CLEANFILES += $(rules_DATA)
43
44 EXTRA_DIST += scripts/bluetooth.rules \
45- scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules
46+ scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules \
47+ scripts/bluetooth.service.in scripts/org.bluez.service
48
49 EXTRA_DIST += doc/manager-api.txt \
50 doc/adapter-api.txt doc/device-api.txt \
51@@ -417,9 +432,9 @@ pkgconfigdir = $(libdir)/pkgconfig
52
53 pkgconfig_DATA = bluez.pc
54
55-DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles
56+DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --with-systemdsystemunitdir=
57
58-DISTCLEANFILES = $(pkgconfig_DATA)
59+DISTCLEANFILES = $(pkgconfig_DATA) scripts/bluetooth.service
60
61 MAINTAINERCLEANFILES = Makefile.in \
62 aclocal.m4 configure config.h.in config.sub config.guess \
63diff --git a/configure.ac b/configure.ac
64index bc2658c..b4502ab 100644
65--- a/configure.ac
66+++ b/configure.ac
67@@ -71,5 +71,14 @@ if (test -n "${path_systemdunit}"); then
68 fi
69 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
70
71+# systemd
72+
73+AC_ARG_WITH([systemdsystemunitdir],
74+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
75+ [],
76+ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
77+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
78+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
79+
80 AC_OUTPUT(Makefile scripts/bluetooth.rules doc/version.xml
81 src/bluetoothd.8 src/bluetooth.service bluez.pc)
82diff --git a/scripts/.gitignore b/scripts/.gitignore
83new file mode 100644
84index 0000000..4b9f765
85--- /dev/null
86+++ b/scripts/.gitignore
87@@ -0,0 +1 @@
88+bluetooth.service
89diff --git a/scripts/bluetooth.service.in b/scripts/bluetooth.service.in
90new file mode 100644
91index 0000000..d0089ea
92--- /dev/null
93+++ b/scripts/bluetooth.service.in
94@@ -0,0 +1,13 @@
95+[Unit]
96+Description=Bluetooth Manager
97+After=syslog.target
98+
99+[Service]
100+Type=dbus
101+BusName=org.bluez
102+ExecStart=@sbindir@/bluetoothd -n
103+StandardOutput=syslog
104+
105+[Install]
106+WantedBy=bluetooth.target
107+Alias=dbus-org.bluez.service
108diff --git a/scripts/org.bluez.service b/scripts/org.bluez.service
109new file mode 100644
110index 0000000..dd7ae8f
111--- /dev/null
112+++ b/scripts/org.bluez.service
113@@ -0,0 +1,5 @@
114+[D-BUS Service]
115+Name=org.bluez
116+Exec=/bin/false
117+User=root
118+SystemdService=dbus-org.bluez.service
119--
1201.7.6
121
This page took 0.098243 seconds and 4 git commands to generate.