summaryrefslogtreecommitdiff
path: root/sys-apps/watchdog/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-apps/watchdog/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-apps/watchdog/files')
-rw-r--r--sys-apps/watchdog/files/watchdog-5.15-musl-nfs.patch27
-rw-r--r--sys-apps/watchdog/files/watchdog-5.15-musl.patch23
-rw-r--r--sys-apps/watchdog/files/watchdog-conf.d5
-rw-r--r--sys-apps/watchdog/files/watchdog-init.d47
-rw-r--r--sys-apps/watchdog/files/watchdog-init.d-r143
-rw-r--r--sys-apps/watchdog/files/watchdog.service10
6 files changed, 155 insertions, 0 deletions
diff --git a/sys-apps/watchdog/files/watchdog-5.15-musl-nfs.patch b/sys-apps/watchdog/files/watchdog-5.15-musl-nfs.patch
new file mode 100644
index 000000000000..bee4ddc8d7bc
--- /dev/null
+++ b/sys-apps/watchdog/files/watchdog-5.15-musl-nfs.patch
@@ -0,0 +1,27 @@
+commit f52c40680f0aad44b9ae16648803453ec00cbb2c
+Author: Paul Crawford <psc@sat.dundee.ac.uk>
+Date: Fri Dec 30 15:55:45 2016 +0000
+
+ Compile with musl when nfs is disabled
+
+ musl does by default not ship with rpc headers. The watchdog should
+ not require rpc headers when nfs support is disabled.
+
+ Patch by Felix Janda <fjanda@users.sf.net>
+
+diff --git a/include/sundries.h b/include/sundries.h
+index 4379982..98c489a 100644
+--- a/include/sundries.h
++++ b/include/sundries.h
+@@ -9,9 +9,11 @@
+ #include <signal.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
++#if HAVE_NFS
+ #if !defined(bool_t) && !defined(__GLIBC__)
+ #include <rpc/types.h>
+ #endif
++#endif
+
+ extern int mount_mount_quiet;
+ extern int mount_verbose;
diff --git a/sys-apps/watchdog/files/watchdog-5.15-musl.patch b/sys-apps/watchdog/files/watchdog-5.15-musl.patch
new file mode 100644
index 000000000000..ae62c8014e5b
--- /dev/null
+++ b/sys-apps/watchdog/files/watchdog-5.15-musl.patch
@@ -0,0 +1,23 @@
+commit c5cb4e1a0339844ae3f55ff1dc4a716c28012f05
+Author: Paul Crawford <psc@sat.dundee.ac.uk>
+Date: Tue Jun 28 18:08:48 2016 +0100
+
+ Include linux/param.h for EXEC_PAGESIZE definition
+
+ Musl does not include linux/param.h whereas glibc does, so it fails
+ to build on musl. Patch supplied by Khem Raj <raj.khem@gmail.com>
+
+diff --git a/src/watchdog.c b/src/watchdog.c
+index acf6450..486384a 100644
+--- a/src/watchdog.c
++++ b/src/watchdog.c
+@@ -26,6 +26,9 @@
+ #include <sys/param.h> /* For EXEC_PAGESIZE */
+ #include <linux/oom.h>
+ #include <linux/watchdog.h>
++#ifdef __linux__
++#include <linux/param.h>
++#endif
+ #include <string.h>
+
+ #include <libgen.h>
diff --git a/sys-apps/watchdog/files/watchdog-conf.d b/sys-apps/watchdog/files/watchdog-conf.d
new file mode 100644
index 000000000000..39c0f808eff0
--- /dev/null
+++ b/sys-apps/watchdog/files/watchdog-conf.d
@@ -0,0 +1,5 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# for more info, see watchdog(8)
+WATCHDOG_OPTS=""
diff --git a/sys-apps/watchdog/files/watchdog-init.d b/sys-apps/watchdog/files/watchdog-init.d
new file mode 100644
index 000000000000..734a02cdbcbe
--- /dev/null
+++ b/sys-apps/watchdog/files/watchdog-init.d
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+ use logger
+}
+
+get_config() {
+ set -- ${WATCHDOG_OPTS}
+ while [ -n "$1" ] ; do
+ if [ "$1" = "-c" -o "$1" = "--config-file" ] ; then
+ echo $2
+ return
+ fi
+ shift
+ done
+ echo /etc/watchdog.conf
+}
+
+get_delay() {
+ # man this is fugly
+ sed -n \
+ -e '1{x;s:.*:10:;x}' \
+ -e 's:#.*::' \
+ -e 's:^[[:space:]]*::' \
+ -e '/^interval/{s:.*=::;h}' \
+ -e '${g;p}' \
+ $(get_config)
+}
+
+start() {
+ ebegin "Starting watchdog"
+ start-stop-daemon --start \
+ --exec /usr/sbin/watchdog --pidfile /var/run/watchdog.pid \
+ -- ${WATCHDOG_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping watchdog"
+ start-stop-daemon --stop \
+ --exec /usr/sbin/watchdog --pidfile /var/run/watchdog.pid \
+ --retry $(get_delay)
+ eend $?
+}
diff --git a/sys-apps/watchdog/files/watchdog-init.d-r1 b/sys-apps/watchdog/files/watchdog-init.d-r1
new file mode 100644
index 000000000000..363c8be9bd24
--- /dev/null
+++ b/sys-apps/watchdog/files/watchdog-init.d-r1
@@ -0,0 +1,43 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+pidfile="/var/run/watchdog.pid"
+command="/usr/sbin/watchdog"
+command_args="${WATCHDOG_OPTS}"
+
+depend() {
+ need localmount
+ use logger
+}
+
+get_config() {
+ set -- ${WATCHDOG_OPTS}
+ while [ -n "$1" ] ; do
+ if [ "$1" = "-c" -o "$1" = "--config-file" ] ; then
+ echo $2
+ return
+ fi
+ shift
+ done
+ echo /etc/watchdog.conf
+}
+
+get_delay() {
+ # man this is fugly
+ sed -n \
+ -e '1{x;s:.*:10:;x}' \
+ -e 's:#.*::' \
+ -e 's:^[[:space:]]*::' \
+ -e '/^interval/{s:.*=::;h}' \
+ -e '${g;p}' \
+ $(get_config)
+}
+
+stop() {
+ ebegin "Stopping watchdog"
+ start-stop-daemon --stop \
+ --exec ${command} --pidfile ${pidfile} \
+ --retry $(get_delay)
+ eend $?
+}
diff --git a/sys-apps/watchdog/files/watchdog.service b/sys-apps/watchdog/files/watchdog.service
new file mode 100644
index 000000000000..9ec1076e6689
--- /dev/null
+++ b/sys-apps/watchdog/files/watchdog.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=watchdog daemon
+After=syslog.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/watchdog
+
+[Install]
+WantedBy=multi-user.target