* [PATCH BlueZ v4 1/3] install: Fix installations to pkglibexecdir
2019-06-04 20:28 [PATCH BlueZ v4 0/3] mesh - Service and Installation Brian Gix
@ 2019-06-04 20:28 ` Brian Gix
2019-06-04 20:28 ` [PATCH BlueZ v4 2/3] build: Add support for systemd bluetooth-mesh service Brian Gix
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Brian Gix @ 2019-06-04 20:28 UTC (permalink / raw)
To: linux-bluetooth
Cc: inga.stotland, brian.gix, ludwig.nussel, marcel, johan.hedberg,
luiz.dentz
From: Ludwig Nussel <ludwig.nussel@suse.de>
In 78bce4800 libexecdir was switched to pkglibexecdir. To use the
matching installation script, use pkglibexec_Programs instead of
libexec_Programs.
---
Makefile.am | 4 ++--
Makefile.mesh | 2 +-
Makefile.obexd | 2 +-
Makefile.tools | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 2583fbdd9..9d25a815b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,7 @@ EXTRA_DIST =
pkglibexecdir = $(libexecdir)/bluetooth
-libexec_PROGRAMS =
+pkglibexec_PROGRAMS =
pkgincludedir = $(includedir)/bluetooth
@@ -242,7 +242,7 @@ plugins_external_dummy_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
plugins_external_dummy_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
endif
-libexec_PROGRAMS += src/bluetoothd
+pkglibexec_PROGRAMS += src/bluetoothd
src_bluetoothd_SOURCES = $(builtin_sources) \
$(attrib_sources) $(btio_sources) \
diff --git a/Makefile.mesh b/Makefile.mesh
index d494287ab..8dacc104c 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -28,7 +28,7 @@ mesh_sources = mesh/mesh.h mesh/mesh.c \
mesh/pb-adv.h mesh/pb-adv.c \
mesh/keyring.h mesh/keyring.c \
mesh/mesh-defs.h
-libexec_PROGRAMS += mesh/bluetooth-meshd
+pkglibexec_PROGRAMS += mesh/bluetooth-meshd
mesh_bluetooth_meshd_SOURCES = $(mesh_sources) mesh/main.c
mesh_bluetooth_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c
diff --git a/Makefile.obexd b/Makefile.obexd
index 1c1e500fe..d36874770 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -51,7 +51,7 @@ obexd_builtin_modules += mns
obexd_builtin_sources += obexd/client/mns.c obexd/src/map_ap.h \
obexd/client/map-event.h
-libexec_PROGRAMS += obexd/src/obexd
+pkglibexec_PROGRAMS += obexd/src/obexd
obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \
$(obexd_builtin_sources) \
diff --git a/Makefile.tools b/Makefile.tools
index 379e127b6..7d5361bcd 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -43,7 +43,7 @@ monitor_btmon_LDADD = lib/libbluetooth-internal.la \
endif
if LOGGER
-libexec_PROGRAMS += tools/btmon-logger
+pkglibexec_PROGRAMS += tools/btmon-logger
tools_btmon_logger_SOURCES = tools/btmon-logger.c
tools_btmon_logger_LDADD = src/libshared-mainloop.la
--
2.14.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ v4 2/3] build: Add support for systemd bluetooth-mesh service
2019-06-04 20:28 [PATCH BlueZ v4 0/3] mesh - Service and Installation Brian Gix
2019-06-04 20:28 ` [PATCH BlueZ v4 1/3] install: Fix installations to pkglibexecdir Brian Gix
@ 2019-06-04 20:28 ` Brian Gix
2019-06-04 20:28 ` [PATCH BlueZ v4 3/3] mesh: Do not daemonize, run in foreground or as service Brian Gix
2019-06-06 19:03 ` [PATCH BlueZ v4 0/3] mesh - Service and Installation Gix, Brian
3 siblings, 0 replies; 5+ messages in thread
From: Brian Gix @ 2019-06-04 20:28 UTC (permalink / raw)
To: linux-bluetooth
Cc: inga.stotland, brian.gix, ludwig.nussel, marcel, johan.hedberg,
luiz.dentz
From: Inga Stotland <inga.stotland@intel.com>
This adds support for installing systemd bluetooth-mesh service unit
and D-Bus service file that references this systemd unit.
---
Makefile.mesh | 14 ++++++++++++--
mesh/bluetooth-mesh.service.in | 17 +++++++++++++++++
mesh/org.bluez.mesh.service | 5 +++++
3 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 mesh/bluetooth-mesh.service.in
create mode 100644 mesh/org.bluez.mesh.service
diff --git a/Makefile.mesh b/Makefile.mesh
index 8dacc104c..85b88eba4 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -4,6 +4,11 @@ if DATAFILES
dbus_DATA += mesh/bluetooth-mesh.conf
endif
+if SYSTEMD
+systemdsystemunit_DATA += mesh/bluetooth-mesh.service
+dbussystembus_DATA += mesh/org.bluez.mesh.service
+endif
+
mesh_sources = mesh/mesh.h mesh/mesh.c \
mesh/net-keys.h mesh/net-keys.c \
mesh/mesh-io.h mesh/mesh-io.c \
@@ -32,7 +37,12 @@ pkglibexec_PROGRAMS += mesh/bluetooth-meshd
mesh_bluetooth_meshd_SOURCES = $(mesh_sources) mesh/main.c
mesh_bluetooth_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c
-mesh_bluetooth_meshd_DEPENDENCIES = $(ell_dependencies) src/libshared-ell.la
+mesh_bluetooth_meshd_DEPENDENCIES = $(ell_dependencies) src/libshared-ell.la \
+ mesh/bluetooth-mesh.service
+
+EXTRA_DIST += mesh/bluetooth-mesh.conf mesh/bluetooth-mesh.service.in \
+ mesh/org.bluez.mesh.service
+
+CLEANFILES += mesh/bluetooth-mesh.service
-EXTRA_DIST += mesh/bluetooth-mesh.conf
endif
diff --git a/mesh/bluetooth-mesh.service.in b/mesh/bluetooth-mesh.service.in
new file mode 100644
index 000000000..818319132
--- /dev/null
+++ b/mesh/bluetooth-mesh.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=Bluetooth mesh service
+ConditionPathIsDirectory=/sys/class/bluetooth
+
+[Service]
+Type=dbus
+BusName=org.bluez.mesh
+ExecStart=@pkglibexecdir@/bluetooth-meshd
+NotifyAccess=main
+LimitNPROC=1
+ProtectHome=true
+ProtectSystem=full
+Restart=on-failure
+
+[Install]
+WantedBy=bluetooth.target
+Alias=dbus-org.bluez.mesh.service
diff --git a/mesh/org.bluez.mesh.service b/mesh/org.bluez.mesh.service
new file mode 100644
index 000000000..a61c44455
--- /dev/null
+++ b/mesh/org.bluez.mesh.service
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.bluez.mesh
+Exec=/bin/false
+User=root
+SystemdService=dbus-org.bluez.mesh.service
--
2.14.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ v4 3/3] mesh: Do not daemonize, run in foreground or as service
2019-06-04 20:28 [PATCH BlueZ v4 0/3] mesh - Service and Installation Brian Gix
2019-06-04 20:28 ` [PATCH BlueZ v4 1/3] install: Fix installations to pkglibexecdir Brian Gix
2019-06-04 20:28 ` [PATCH BlueZ v4 2/3] build: Add support for systemd bluetooth-mesh service Brian Gix
@ 2019-06-04 20:28 ` Brian Gix
2019-06-06 19:03 ` [PATCH BlueZ v4 0/3] mesh - Service and Installation Gix, Brian
3 siblings, 0 replies; 5+ messages in thread
From: Brian Gix @ 2019-06-04 20:28 UTC (permalink / raw)
To: linux-bluetooth
Cc: inga.stotland, brian.gix, ludwig.nussel, marcel, johan.hedberg,
luiz.dentz
From: Inga Stotland <inga.stotland@intel.com>
This removes call to daemon(). "--nodetach" option is retained
to set umask().
Also, adds description for dbus-debug option.
---
mesh/main.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/mesh/main.c b/mesh/main.c
index a621300e6..3cecd8fbf 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -2,7 +2,7 @@
*
* BlueZ - Bluetooth protocol stack for Linux
*
- * Copyright (C) 2017-2018 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
@@ -41,6 +41,7 @@ static const struct option main_options[] = {
{ "config", optional_argument, NULL, 'c' },
{ "nodetach", no_argument, NULL, 'n' },
{ "debug", no_argument, NULL, 'd' },
+ { "dbus-debug", no_argument, NULL, 'b' },
{ "help", no_argument, NULL, 'h' },
{ }
};
@@ -49,12 +50,13 @@ static void usage(void)
{
l_info("");
l_info("Usage:\n"
- "\tmeshd [options]\n");
+ "\tbluetooth-meshd [options]\n");
l_info("Options:\n"
"\t--index <hcinum> Use specified controller\n"
"\t--config Configuration directory\n"
"\t--nodetach Run in foreground\n"
"\t--debug Enable debug output\n"
+ "\t--dbus-debug Enable D-Bus debugging\n"
"\t--help Show %s information\n", __func__);
}
@@ -170,7 +172,8 @@ int main(int argc, char *argv[])
goto done;
}
- umask(0077);
+ if (!detached)
+ umask(0077);
dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS);
if (!dbus) {
@@ -190,14 +193,6 @@ int main(int argc, char *argv[])
goto done;
}
- if (detached) {
- if (daemon(0, 0)) {
- perror("Failed to start meshd daemon");
- status = EXIT_FAILURE;
- goto done;
- }
- }
-
status = l_main_run_with_signal(signal_handler, NULL);
done:
--
2.14.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ v4 0/3] mesh - Service and Installation
2019-06-04 20:28 [PATCH BlueZ v4 0/3] mesh - Service and Installation Brian Gix
` (2 preceding siblings ...)
2019-06-04 20:28 ` [PATCH BlueZ v4 3/3] mesh: Do not daemonize, run in foreground or as service Brian Gix
@ 2019-06-06 19:03 ` Gix, Brian
3 siblings, 0 replies; 5+ messages in thread
From: Gix, Brian @ 2019-06-06 19:03 UTC (permalink / raw)
To: linux-bluetooth
Cc: ludwig.nussel, marcel, johan.hedberg, luiz.dentz, Stotland, Inga
These three patches applied, Thanks
On Tue, 2019-06-04 at 13:28 -0700, Brian Gix wrote:
> This patch set of changes from Inga and Ludwig are needed to install
> the bluetooth-mesh daemon as a systemd service, with access to D-bus.
>
> Ludwig's patch from April fixes a problem with installation locations
> for *all* of BlueZ, and Inga's adds the bluetooth-mesh service.
>
>
> Inga Stotland (2):
> build: Add support for systemd bluetooth-mesh service
> mesh: Do not daemonize, run in foreground or as service
>
> Ludwig Nussel (1):
> install: Fix installations to pkglibexecdir
>
> Makefile.am | 4 ++--
> Makefile.mesh | 16 +++++++++++++---
> Makefile.obexd | 2 +-
> Makefile.tools | 2 +-
> mesh/bluetooth-mesh.service.in | 17 +++++++++++++++++
> mesh/main.c | 17 ++++++-----------
> mesh/org.bluez.mesh.service | 5 +++++
> 7 files changed, 45 insertions(+), 18 deletions(-)
> create mode 100644 mesh/bluetooth-mesh.service.in
> create mode 100644 mesh/org.bluez.mesh.service
>
^ permalink raw reply [flat|nested] 5+ messages in thread