[Buildroot] [PATCH 2/3] package/mosquitto: Switch systemd unit to Type=notify and depend on network

Titouan Christophe titouan.christophe at railnova.eu
Thu Jul 18 10:06:35 UTC 2019


Signed-off-by: Titouan Christophe <titouan.christophe at railnova.eu>
---
RFC: Would it be better to use the mosquitto.service file provided upstream ?
https://github.com/eclipse/mosquitto/blob/master/service/systemd/mosquitto.service.notify
---
 package/mosquitto/mosquitto.mk      | 4 ++++
 package/mosquitto/mosquitto.service | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/package/mosquitto/mosquitto.mk b/package/mosquitto/mosquitto.mk
index ed72af754a..333cce35c2 100644
--- a/package/mosquitto/mosquitto.mk
+++ b/package/mosquitto/mosquitto.mk
@@ -23,6 +23,10 @@ else
 MOSQUITTO_MAKE_OPTS += WITH_STATIC_LIBRARIES=no WITH_SHARED_LIBRARIES=yes
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+MOSQUITTO_MAKE_OPTS += WITH_SYSTEMD=yes
+endif
+
 # adns uses getaddrinfo_a
 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
 MOSQUITTO_MAKE_OPTS += WITH_ADNS=yes
diff --git a/package/mosquitto/mosquitto.service b/package/mosquitto/mosquitto.service
index 2d1939d1c7..24c9d8e948 100644
--- a/package/mosquitto/mosquitto.service
+++ b/package/mosquitto/mosquitto.service
@@ -1,7 +1,10 @@
 [Unit]
 Description=Mosquitto MQTT broker
+After=network-online.target
+Wants=network-online.target
 
 [Service]
+Type=notify
 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=always
-- 
2.21.0



More information about the buildroot mailing list