Skip to contentSkip to conversation

watchdog: install wd_keepalive service file to its own package

PATCH In review Yi Zhao 2 participants 3 messages Sep 29, 2017 – Oct 11, 2017

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/1 watchdog: install wd_keepalive service file to its own package

Move wd_keepalive.service from watchdog package to watchdog-keepalive package. Also remove debian specific code from the service file.

---
 meta/recipes-extended/watchdog/watchdog_5.15.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-extended/watchdog/watchdog_5.15.bb +7 -1
index 3d0b72e..5246b84 100644
@@ -36,12 +36,17 @@ 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 wd_keepalive.service"
+SYSTEMD_PACKAGES = "${PN} ${PN}-keepalive"
+SYSTEMD_SERVICE_${PN} = "watchdog.service"
+SYSTEMD_SERVICE_${PN}-keepalive = "wd_keepalive.service"
 
 do_install_append() {
 	install -d ${D}${systemd_system_unitdir}
 	install -m 0644 ${S}/debian/watchdog.service ${D}${systemd_system_unitdir}
 	install -m 0644 ${S}/debian/wd_keepalive.service ${D}${systemd_system_unitdir}
+	# remove specific code for debian
+	sed -i -e '/^ExecStartPost/d' \
+		-e '/^ExecStopPost/d' ${D}${systemd_system_unitdir}/wd_keepalive.service
 
 	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
@@ -54,6 +59,7 @@ PACKAGES =+ "${PN}-keepalive"
 
 FILES_${PN}-keepalive = " \
     ${sysconfdir}/init.d/wd_keepalive \
+    ${systemd_system_unitdir}/wd_keepalive.service \
     ${sbindir}/wd_keepalive \
 "
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Yi Zhao

Move wd_keepalive.service from watchdog package to watchdog-keepalive package. Also remove debian specific code from the service file.

Remember to say *why*. Reading the diff tells us that you are putting wd-keepalive into a separate package, but doesn't explain *why*.

I suspect its because you should only be running one of them and if they both start then they'll race. I also suspect the real solution is to have them either one or both disabled by default instead, as it appears to be perfectly reasonable to start with one and then swap to the other.

Ross

author
#2 lore raw
Quoted 7 lines · Ross

On 29 September 2017 at 01:27, Yi Zhao <[email protected] <mailto:[email protected]>> wrote:

Move wd_keepalive.service from watchdog package to watchdog-keepalive package. Also remove debian specific code from the service file.

Remember to say *why*.  Reading the diff tells us that you are putting wd-keepalive into a separate package, but doesn't explain *why*.

My patch just move wd_keepalive.service  file from wathdog package to watchdog-keepalive package to fix commit c14550deb824b3ef8087dede22d664879e85006d .  The package splitting was introduced by commit 7a79aba22be0ca0bc3535dea64a79b697013337d by Fabio Berton and reason is in the log message.

Yi

Quoted 4 lines

I suspect its because you should only be running one of them and if they both start then they'll race.  I also suspect the real solution is to have them either one or both disabled by default instead, as it appears to be perfectly reasonable to start with one and then swap to the other.

Ross