]> code.ossystems Code Review - openembedded-core.git/commitdiff
watchdog: Provide and install initscript
authorDiego Rondini <diego.ml@zoho.com>
Wed, 18 Mar 2015 15:50:45 +0000 (16:50 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 22 Mar 2015 09:22:09 +0000 (09:22 +0000)
Provide and install an initscript for the watchdog package.
In particular:
- watchdog-init.patch adapts redhat initscript to be compatibile with
  OpenEmbedded;
- watchdog-conf.patch selects /dev/watchdog as default device;
- changes to the recipe install and configure the initscript.

Signed-off-by: Diego Rondini <diego.ml@zoho.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/watchdog/watchdog/watchdog-conf.patch [new file with mode: 0644]
meta/recipes-extended/watchdog/watchdog/watchdog-init.patch [new file with mode: 0644]
meta/recipes-extended/watchdog/watchdog_5.14.bb

diff --git a/meta/recipes-extended/watchdog/watchdog/watchdog-conf.patch b/meta/recipes-extended/watchdog/watchdog/watchdog-conf.patch
new file mode 100644 (file)
index 0000000..36f2968
--- /dev/null
@@ -0,0 +1,11 @@
+--- watchdog-5.13.orig/watchdog.conf   2013-02-01 12:15:44.000000000 +0100
++++ watchdog-5.13/watchdog.conf        2014-11-13 10:59:43.233943000 +0100
+@@ -20,7 +20,7 @@
+ #test-binary          = 
+ #test-timeout         = 
+-#watchdog-device      = /dev/watchdog
++watchdog-device       = /dev/watchdog
+ # Defaults compiled into the binary
+ #temperature-device   =
diff --git a/meta/recipes-extended/watchdog/watchdog/watchdog-init.patch b/meta/recipes-extended/watchdog/watchdog/watchdog-init.patch
new file mode 100644 (file)
index 0000000..0fa8ee9
--- /dev/null
@@ -0,0 +1,53 @@
+--- watchdog-5.13.orig/redhat/watchdog.init    2014-11-12 17:18:39.125943000 +0100
++++ watchdog-5.13/redhat/watchdog.init 2014-11-12 18:27:36.189943000 +0100
+@@ -7,7 +7,7 @@
+ #                 Henning P. Schmiedehausen <hps@tanstaafl.de>
+ # Source function library.
+-. /etc/rc.d/init.d/functions
++. /etc/init.d/functions
+ [ -x /usr/sbin/watchdog -a -e /etc/watchdog.conf ] || exit 0
+@@ -23,22 +23,22 @@
+ start() {
+-      echo -n $"Starting $prog: "
++      echo -n "Starting $prog: "
+       if [ -n "$(pidofproc $prog)" ]; then
+-              echo -n $"$prog: already running"
+-              echo_failure
++              echo -n "$prog: already running "
++              failure
+               echo
+               return 1
+       fi
+       if [ "$VERBOSE" = "yes" ]; then
+-          daemon /usr/sbin/${prog} -v
++          /usr/sbin/${prog} -v
+       else
+-          daemon /usr/sbin/${prog}
++          /usr/sbin/${prog}
+         fi
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch $lockfile
+-      [ $RETVAL -eq 0 ] && echo_success
+-      [ $RETVAL -ne 0 ] && echo_failure
++      [ $RETVAL -eq 0 ] && success
++      [ $RETVAL -ne 0 ] && failure
+       echo
+       return $RETVAL
+ }
+@@ -50,8 +50,10 @@
+       # and reboot the box.
+       killproc $prog -TERM
+       RETVAL=$?
+-      echo
+       [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
++      [ $RETVAL -eq 0 ] && success
++      [ $RETVAL -ne 0 ] && failure
++      echo
+       return $RETVAL
+ }
index c77d91dcddd457ae2b41aaa3a25ca83334867e33..9ec0a8e84a452b7b15ff6d639ef0e4e0d7a3775b 100644 (file)
@@ -10,11 +10,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=ecc0551bf54ad97f6b541720f84d6569"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
            file://fixsepbuild.patch \
-          file://fix-ping-failure.patch"
+          file://fix-ping-failure.patch \
+          file://watchdog-init.patch \
+          file://watchdog-conf.patch"
 
 SRC_URI[md5sum] = "5b2dba0c593942f4acc100bca0d560c4"
 SRC_URI[sha256sum] = "620b2f49e9879f2e85c73d4c1f422f9101e6b38e824fea2414befd8bb6866ad1"
 
 inherit autotools
+inherit update-rc.d
+
+INITSCRIPT_NAME = "watchdog.sh"
+INITSCRIPT_PARAMS = "start 15 1 2 3 4 5 . stop 85 0 6 ."
 
 RRECOMMENDS_${PN} = "kernel-module-softdog"
+
+do_install_append() {
+       install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh
+}