From 69ce023a4c156c328839429e70c5b038069da7ce Mon Sep 17 00:00:00 2001 From: Inga Stotland Date: Mon, 3 Jun 2019 23:07:47 -0700 Subject: [PATCH] build: Add support for systemd bluetooth-mesh service This adds support for installing systemd bluetooth-mesh service unit and D-Bus service file that references this systemd unit. Change-Id: I8306de2261244ead765bdae9b6b7bed00f069a61 Signed-off-by: Anupam Roy --- Makefile.mesh | 14 ++++++++++++-- mesh/bluetooth-mesh.service.in | 18 ++++++++++++++++++ mesh/org.bluez.mesh.service | 5 +++++ 3 files changed, 35 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 8713ed6..3471155 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 \ @@ -38,7 +43,12 @@ mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \ 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 0000000..c8afbf5 --- /dev/null +++ b/mesh/bluetooth-mesh.service.in @@ -0,0 +1,18 @@ +[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 +RestartSec=5s + +[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 0000000..a61c444 --- /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.7.4