From 1a9ad16ed8e5048a11d19dc411995137b154870a Mon Sep 17 00:00:00 2001 From: Danny Wood Date: Thu, 27 Jul 2023 16:52:54 +0100 Subject: [PATCH] package/mariadb: add optional systemd dependency If systemd is used we should enable support in mariadb and enable "Type=notify" in the mysqld.service unit file "Type=notify" stops systemd from starting services which depend on mariadb until it has notified systemd that it has finished starting up, this helps avoid startup race conditions Signed-off-by: Danny Wood Signed-off-by: Thomas Petazzoni --- package/mariadb/mariadb.mk | 7 +++++++ package/mariadb/mysqld.service | 2 ++ 2 files changed, 9 insertions(+) diff --git a/package/mariadb/mariadb.mk b/package/mariadb/mariadb.mk index a2701643e1..78e4703eee 100644 --- a/package/mariadb/mariadb.mk +++ b/package/mariadb/mariadb.mk @@ -72,6 +72,13 @@ MARIADB_CONF_OPTS += \ -DLIBRESSL_RESULT__TRYRUN_OUTPUT="LibreSSL $(LIBRESSL_VERSION)" endif +ifeq ($(BR2_PACKAGE_SYSTEMD),y) +MARIADB_DEPENDENCIES += systemd +MARIADB_CONF_OPTS += -DWITH_SYSTEMD=yes +else +MARIADB_CONF_OPTS += -DWITH_SYSTEMD=no +endif + ifeq ($(BR2_PACKAGE_MARIADB_SERVER),y) ifeq ($(BR2_PACKAGE_MARIADB_SERVER_EMBEDDED),y) MARIADB_CONF_OPTS += -DWITH_EMBEDDED_SERVER=ON diff --git a/package/mariadb/mysqld.service b/package/mariadb/mysqld.service index 537430e9a2..9433e14630 100644 --- a/package/mariadb/mysqld.service +++ b/package/mariadb/mysqld.service @@ -9,6 +9,8 @@ Restart=always User=mysql RuntimeDirectory=mysql RuntimeDirectoryMode=0755 +Type=notify +NotifyAccess=all [Install] WantedBy=multi-user.target