Skip to contentSkip to conversation

mdadm: guarded with systemd when install mdadm service

PATCH New Liwei Song 1 participant 2 messages May 22, 2019

lore
Share & tools
lore

Liwei Song

author
#0 lore raw

PATCH 1/2 mdadm: guarded with systemd when install mdadm service

install mdadm related service only when systemd was included in DISTRO_FEATURES.

---
 meta/recipes-extended/mdadm/mdadm_4.1.bb | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
meta/recipes-extended/mdadm/mdadm_4.1.bb +4 -6
index 597faf787a67..8ca42a89ddc5 100644
@@ -59,13 +59,11 @@ do_install_append() {
         install -m 644 ${S}/mdadm.conf-example ${D}${sysconfdir}/mdadm.conf
         install -d ${D}/${sysconfdir}/init.d
         install -m 755 ${WORKDIR}/mdadm.init ${D}${sysconfdir}/init.d/mdmonitor
+        if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true', 'false', d)}; then
+               oe_runmake install-systemd DESTDIR=${D}
+        fi
 }
 
-do_install_append() {
-        oe_runmake install-systemd DESTDIR=${D}
-}
-
-
 do_compile_ptest() {
 	oe_runmake test
 }
@@ -93,4 +91,4 @@ RRECOMMENDS_${PN}-ptest += " \
     kernel-module-raid456 \
 "
 
-FILES_${PN} += "/lib/systemd/*"
+FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','/lib/systemd/*', '', d)}"
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 mdadm: define MAILADDR for mdmonitor service

by default in mdmonitor.service it use mail address to report alerts but this need to set MAILADDR in /etc/mdadm.conf, or the service will be failed excuted.

This patch will set MAILADD to "root" in /etc/mdadm.conf to aviod service run with error.

---
 meta/recipes-extended/mdadm/mdadm_4.1.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-extended/mdadm/mdadm_4.1.bb +1 -0
index 8ca42a89ddc5..8ec1c22a0c62 100644
@@ -57,6 +57,7 @@ do_install() {
 do_install_append() {
         install -d ${D}/${sysconfdir}/
         install -m 644 ${S}/mdadm.conf-example ${D}${sysconfdir}/mdadm.conf
+        sed -i "s/#MAILADDR [email protected]/MAILADDR root/" ${D}${sysconfdir}/mdadm.conf
         install -d ${D}/${sysconfdir}/init.d
         install -m 755 ${WORKDIR}/mdadm.init ${D}${sysconfdir}/init.d/mdmonitor
         if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true', 'false', d)}; then
Signature · 1 line
2.7.4