[OE-core] [PATCH] mdadm: Add systemd support
Add mdadm.service to support systemd systems and add configuration file. Signed-off-by: Li Xin --- meta/recipes-extended/mdadm/files/mdadm.service | 13 + meta/recipes-extended/mdadm/mdadm_3.3.4.bb | 12 +++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-extended/mdadm/files/mdadm.service diff --git a/meta/recipes-extended/mdadm/files/mdadm.service b/meta/recipes-extended/mdadm/files/mdadm.service new file mode 100644 index 000..3664ceb --- /dev/null +++ b/meta/recipes-extended/mdadm/files/mdadm.service @@ -0,0 +1,13 @@ +[Unit] +Description=Software RAID monitoring and management +After=syslog.target +ConditionPathExists=@sysconfdir@/mdadm.conf + +[Service] +Type=forking +PIDFile=@localstatedir@/run/mdadm/mdadm.pid +EnvironmentFile=-@sysconfdir@/sysconfig/mdmonitor +ExecStart=@basesbindir@/mdadm --monitor --scan -f --pid-file=@localstatedir@/run/mdadm/mdadm.pid + +[Install] +WantedBy=multi-user.target diff --git a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb index 1198167..e27f384 100644 --- a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb +++ b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb @@ -14,13 +14,14 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ file://mdadm-3.3.2_x32_abi_time_t.patch \ file://0001-Fix-typo-in-comparision.patch \ file://run-ptest \ + file://mdadm.service \ " SRC_URI[md5sum] = "7ca8b114710f98f53f20c5787b674a09" SRC_URI[sha256sum] = "8ae5f45306b873190e91f410709b00e51997b633c072b33f8efd9f7df022ca68" CFLAGS += "-fno-strict-aliasing" -inherit autotools-brokensep +inherit autotools-brokensep systemd EXTRA_OEMAKE = "CHECK_RUN_DIR=0" # PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h @@ -38,8 +39,17 @@ do_compile() { do_install() { export STRIP="" autotools_do_install +install -d ${D}/${sysconfdir}/ +install -m 644 ${S}/mdadm.conf-example ${D}${sysconfdir}/ +install -d ${D}${systemd_unitdir}/system +install -m 644 ${WORKDIR}/mdadm.service ${D}${systemd_unitdir}/system/ +sed -i -e 's,@basesbindir@,${base_sbindir},g' \ + -e 's,@localstatedir@,${localstatedir},g' \ + -e 's,@sysconfdir@,${sysconfdir},g' \ + ${D}${systemd_unitdir}/system/mdadm.service } +SYSTEMD_SERVICE_${PN} = "mdadm.service" FILES_${PN} += "${base_libdir}/udev/rules.d/*.rules" inherit ptest -- 1.8.4.2 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH] mdadm: Add systemd support
Please use ${systemd_system_unitdir} instead of ${systemd_unitdir}/system Pau Espin Pedrol mail/jabber: pespin.s...@gmail.com http://blog.espeweb.net 2016-02-02 3:22 GMT+01:00 Li Xin : > Add mdadm.service to support systemd systems and add configuration > file. > > Signed-off-by: Li Xin > --- > meta/recipes-extended/mdadm/files/mdadm.service | 13 + > meta/recipes-extended/mdadm/mdadm_3.3.4.bb | 12 +++- > 2 files changed, 24 insertions(+), 1 deletion(-) > create mode 100644 meta/recipes-extended/mdadm/files/mdadm.service > > diff --git a/meta/recipes-extended/mdadm/files/mdadm.service > b/meta/recipes-extended/mdadm/files/mdadm.service > new file mode 100644 > index 000..3664ceb > --- /dev/null > +++ b/meta/recipes-extended/mdadm/files/mdadm.service > @@ -0,0 +1,13 @@ > +[Unit] > +Description=Software RAID monitoring and management > +After=syslog.target > +ConditionPathExists=@sysconfdir@/mdadm.conf > + > +[Service] > +Type=forking > +PIDFile=@localstatedir@/run/mdadm/mdadm.pid > +EnvironmentFile=-@sysconfdir@/sysconfig/mdmonitor > +ExecStart=@basesbindir@/mdadm --monitor --scan -f > --pid-file=@localstatedir@/run/mdadm/mdadm.pid > + > +[Install] > +WantedBy=multi-user.target > diff --git a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb > b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb > index 1198167..e27f384 100644 > --- a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb > +++ b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb > @@ -14,13 +14,14 @@ SRC_URI = > "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ > file://mdadm-3.3.2_x32_abi_time_t.patch \ > file://0001-Fix-typo-in-comparision.patch \ > file://run-ptest \ > + file://mdadm.service \ > " > SRC_URI[md5sum] = "7ca8b114710f98f53f20c5787b674a09" > SRC_URI[sha256sum] = > "8ae5f45306b873190e91f410709b00e51997b633c072b33f8efd9f7df022ca68" > > CFLAGS += "-fno-strict-aliasing" > > -inherit autotools-brokensep > +inherit autotools-brokensep systemd > > EXTRA_OEMAKE = "CHECK_RUN_DIR=0" > # PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's > asm/types.h > @@ -38,8 +39,17 @@ do_compile() { > do_install() { > export STRIP="" > autotools_do_install > +install -d ${D}/${sysconfdir}/ > +install -m 644 ${S}/mdadm.conf-example ${D}${sysconfdir}/ > +install -d ${D}${systemd_unitdir}/system > +install -m 644 ${WORKDIR}/mdadm.service > ${D}${systemd_unitdir}/system/ > +sed -i -e 's,@basesbindir@,${base_sbindir},g' \ > + -e 's,@localstatedir@,${localstatedir},g' \ > + -e 's,@sysconfdir@,${sysconfdir},g' \ > + ${D}${systemd_unitdir}/system/mdadm.service > } > > +SYSTEMD_SERVICE_${PN} = "mdadm.service" > FILES_${PN} += "${base_libdir}/udev/rules.d/*.rules" > > inherit ptest > -- > 1.8.4.2 > > > > -- > ___ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core > -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core