Skip to contentSkip to conversation

watchdog: enable systemd support

PATCH In review [email protected] 1 participant 2 messages Sep 12, 2016 – Sep 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 watchdog: enable systemd support

From: Roy Li <[email protected]>

1. inherit systemd, and add two unit files which are from Fedora 23
2. auto load soft dog kernel module

---
 .../watchdog/watchdog/watchdog-ping.service           | 11 +++++++++++
 .../watchdog/watchdog/watchdog.service                | 11 +++++++++++
 meta/recipes-extended/watchdog/watchdog_5.15.bb       | 19 +++++++++++++++++--
 3 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/watchdog/watchdog/watchdog-ping.service
 create mode 100644 meta/recipes-extended/watchdog/watchdog/watchdog.service
meta/recipes-extended/watchdog/watchdog/watchdog-ping.service new file +11 -0
new file mode 100644
index 0000000..44bac9d
@@ -0,0 +1,11 @@
+[Unit]
+Description=watchdog daemon for use with ping test / network dependency
+After=network.target
+Conflicts=watchdog.service
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/watchdog
+
+[Install]
+WantedBy=multi-user.target
meta/recipes-extended/watchdog/watchdog/watchdog.service new file +11 -0
new file mode 100644
index 0000000..c5faa4e
@@ -0,0 +1,11 @@
+[Unit]
+Description=watchdog daemon
+# man systemd.special
+# auto added After=basic.target
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/watchdog
+
+[Install]
+WantedBy=multi-user.target
meta/recipes-extended/watchdog/watchdog_5.15.bb +17 -2
index cedfc04..826e31f 100644
@@ -13,6 +13,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
            file://watchdog-init.patch \
            file://watchdog-conf.patch \
            file://wd_keepalive.init \
+           file://watchdog-ping.service \
+           file://watchdog.service \
 "
 
 SRC_URI[md5sum] = "678c32f6f35a0492c9c1b76b4aa88828"
@@ -22,7 +24,7 @@ UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/watchdog/files/watchdog/"
 UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/"
 
 inherit autotools
-inherit update-rc.d
+inherit update-rc.d systemd
 
 DEPENDS_append_libc-musl = " libtirpc "
 CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
@@ -37,16 +39,29 @@ INITSCRIPT_PARAMS_${PN} = "start 15 1 2 3 4 5 . stop 85 0 6 ."
 INITSCRIPT_NAME_${PN}-keepalive = "wd_keepalive"
 INITSCRIPT_PARAMS_${PN}-keepalive = "start 15 1 2 3 4 5 . stop 85 0 6 ."
 
+SYSTEMD_SERVICE_${PN} = "watchdog.service"
+
 do_install_append() {
-	install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh
+    install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh
     install -Dm 0755 ${WORKDIR}/wd_keepalive.init ${D}${sysconfdir}/init.d/wd_keepalive
 
     # watchdog.conf is provided by the watchdog-config recipe
     rm ${D}${sysconfdir}/watchdog.conf
+
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/watchdog*.service ${D}${systemd_system_unitdir}
+
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${sysconfdir}/modules-load.d
+        echo "softdog" > ${D}${sysconfdir}/modules-load.d/softdog.conf
+        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/*.service
+    fi
 }
 
 PACKAGES =+ "${PN}-keepalive"
 
+FILES_${PN} += "${systemd_system_unitdir}/*"
+
 FILES_${PN}-keepalive = " \
     ${sysconfdir}/init.d/wd_keepalive \
     ${sbindir}/wd_keepalive \
Signature · 1 line
2.8.1
#1 lore raw

Ping.

Quoted 122 lines

-----Original Message-----
From: [email protected] [mailto:openembedded-core- [email protected]] On Behalf Of [email protected]
Sent: Monday, September 12, 2016 1:01 PM
To: [email protected]
Subject: [OE-core] [PATCH][v5] watchdog: enable systemd support

From: Roy Li <[email protected]>

1. inherit systemd, and add two unit files which are from Fedora 23
2. auto load soft dog kernel module

---
 .../watchdog/watchdog/watchdog-ping.service           | 11 +++++++++++
 .../watchdog/watchdog/watchdog.service                | 11 +++++++++++
 meta/recipes-extended/watchdog/watchdog_5.15.bb       | 19 +++++++++++++++++--
 3 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/watchdog/watchdog/watchdog-ping.service
 create mode 100644 meta/recipes-extended/watchdog/watchdog/watchdog.service
meta/recipes- renamed from meta/recipes-extended/watchdog/watchdog/watchdog-ping.service +0 -0

extended/watchdog/watchdog/watchdog-ping.service
new file mode 100644
index 0000000..44bac9d

meta/recipes-extended/watchdog/watchdog/watchdog-ping.service new file +11 -0
@@ -0,0 +1,11 @@
+[Unit]
+Description=watchdog daemon for use with ping test / network dependency
+After=network.target
+Conflicts=watchdog.service
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/watchdog
+
+[Install]
+WantedBy=multi-user.target
meta/recipes- renamed from meta/recipes-extended/watchdog/watchdog/watchdog.service +0 -0

extended/watchdog/watchdog/watchdog.service
new file mode 100644
index 0000000..c5faa4e

meta/recipes-extended/watchdog/watchdog/watchdog.service new file +11 -0
@@ -0,0 +1,11 @@
+[Unit]
+Description=watchdog daemon
+# man systemd.special
+# auto added After=basic.target
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/watchdog
+
+[Install]
+WantedBy=multi-user.target
meta/recipes- renamed from meta/recipes-extended/watchdog/watchdog_5.15.bb +0 -0

extended/watchdog/watchdog_5.15.bb
index cedfc04..826e31f 100644

meta/recipes-extended/watchdog/watchdog_5.15.bb +2 -0
@@ -13,6 +13,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
            file://watchdog-init.patch \
            file://watchdog-conf.patch \
            file://wd_keepalive.init \
+           file://watchdog-ping.service \
+           file://watchdog.service \
 "
 
 SRC_URI[md5sum] = "678c32f6f35a0492c9c1b76b4aa88828"
@@ -22,7 +24,7 @@ UPSTREAM_CHECK_URI =

"http://sourceforge.net/projects/watchdog/files/watchdog/"
UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/"

inherit autotools

meta/recipes-extended/watchdog/watchdog_5.15.bb +15 -3
-inherit update-rc.d
+inherit update-rc.d systemd
 
 DEPENDS_append_libc-musl = " libtirpc "
 CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
@@ -37,16 +39,29 @@ INITSCRIPT_PARAMS_${PN} = "start 15 1 2 3 4 5 . stop 85 0 6 ."
 INITSCRIPT_NAME_${PN}-keepalive = "wd_keepalive"
 INITSCRIPT_PARAMS_${PN}-keepalive = "start 15 1 2 3 4 5 . stop 85 0 6 ."
 
+SYSTEMD_SERVICE_${PN} = "watchdog.service"
+
 do_install_append() {
-	install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh
+    install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh
     install -Dm 0755 ${WORKDIR}/wd_keepalive.init ${D}${sysconfdir}/init.d/wd_keepalive
 
     # watchdog.conf is provided by the watchdog-config recipe
     rm ${D}${sysconfdir}/watchdog.conf
+
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/watchdog*.service ${D}${systemd_system_unitdir}
+
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${sysconfdir}/modules-load.d
+        echo "softdog" > ${D}${sysconfdir}/modules-load.d/softdog.conf
+        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/*.service
+    fi
 }
 
 PACKAGES =+ "${PN}-keepalive"
 
+FILES_${PN} += "${systemd_system_unitdir}/*"
+
 FILES_${PN}-keepalive = " \
     ${sysconfdir}/init.d/wd_keepalive \
     ${sbindir}/wd_keepalive \
--

2.8.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core