From: Jackie Huang <jackie.hu...@windriver.com>

inherit systemd and add .service for systemd support

Signed-off-by: Jackie Huang <jackie.hu...@windriver.com>
---
 .../recipes-cgl/openais/files/openais.service           | 14 ++++++++++++++
 meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb    | 17 +++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais.service

diff --git a/meta-cgl-common/recipes-cgl/openais/files/openais.service 
b/meta-cgl-common/recipes-cgl/openais/files/openais.service
new file mode 100644
index 0000000..230e4bb
--- /dev/null
+++ b/meta-cgl-common/recipes-cgl/openais/files/openais.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=OpenAIS Cluster Framework
+ConditionKernelCommandLine=!nocluster
+Requires=network-online.target
+After=network-online.target
+
+[Service]
+ExecStart=@DATADIR@/openais/openais start
+ExecStop=@DATADIR@/openais/openais stop
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb 
b/meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb
index e503cec..23da0a2 100644
--- a/meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb
+++ b/meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb
@@ -9,10 +9,23 @@ SRC_URI = " \
     file://fix-lcrso-linkage.patch \
     file://build-cleanup-configure-ac.patch \
     file://openais-fix-bash.patch \
-       "
+    file://openais.service \
+    "
+
 SRC_URI[md5sum] = "e500ad3c49fdc45d8653f864e80ed82c"
 SRC_URI[sha256sum] = 
"974b4959f3c401c16156dab31e65a6d45bbf84dd85a88c2a362712e738c06934"
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig systemd
+
+SYSTEMD_SERVICE_${PN} = "openais.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+
+do_install_append() {
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', 
d)}; then
+        install -D -m 0755 ${D}${sysconfdir}/init.d/openais 
${D}${datadir}/${BPN}/openais
+        install -D -m 0644 ${WORKDIR}/openais.service 
${D}${systemd_system_unitdir}/openais.service
+        sed -i -e 's,@DATADIR@,${datadir},g' 
${D}${systemd_system_unitdir}/openais.service
+    fi
+}
 
 FILES_${PN}-dbg += "${libexecdir}/lcrso/.debug"
-- 
2.11.0

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to