summaryrefslogtreecommitdiff
path: root/system/watchdog
diff options
context:
space:
mode:
authorlockywolf <slackbuilds_watchdog_2022-04-03_45cc54ac-b35f-11ec-834e-cf2c364267f5@lockywolf.net>2022-04-06 17:44:37 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2022-04-09 15:45:49 +0700
commit14fd9e26c6d870d3df13f90e203fd73c1fb73cc3 (patch)
tree77f00b4c6d6083ad128de19e0a69426f9edd6fe2 /system/watchdog
parente0869634d338d896594fe477f3bf7d701f250d63 (diff)
downloadslackbuilds-14fd9e26c6d870d3df13f90e203fd73c1fb73cc3.tar.gz
system/watchdog: Moved from python.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/watchdog')
-rw-r--r--system/watchdog/README15
-rw-r--r--system/watchdog/doinst.sh31
-rw-r--r--system/watchdog/slack-desc19
-rw-r--r--system/watchdog/watchdog.SlackBuild121
-rw-r--r--system/watchdog/watchdog.info10
5 files changed, 196 insertions, 0 deletions
diff --git a/system/watchdog/README b/system/watchdog/README
new file mode 100644
index 0000000000..d39c8c35ab
--- /dev/null
+++ b/system/watchdog/README
@@ -0,0 +1,15 @@
+watchdog is a daemon that periodically pokes a hardware chip,
+ and if it fails to do so (presumaby because the system got stuck),
+ the chip would reboot the system. A somehow working software
+ emulation of this chip, called "softdog" also exists in Linux.
+ A reboot can be triggered by some other criteria too.
+
+This script installs a RedHat-style initscript, but you can run it from
+/etc/rc.d/rc.local too.
+
+This daemon needs a proper kernel driver to work.
+Some machines, such as raspberry pi 4b, provide /dev/wachdog by default.
+Intel systems might require editing /etc/sysconfig/watchdog to have
+START_MOD_CMD="modprobe iTCO_wdt" and
+
+You can try "softdog" if nothing better is available.
diff --git a/system/watchdog/doinst.sh b/system/watchdog/doinst.sh
new file mode 100644
index 0000000000..c6ba0557df
--- /dev/null
+++ b/system/watchdog/doinst.sh
@@ -0,0 +1,31 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+
+
+preserve_perms /etc/rc.d/init.d/watchdog.new
+
+config /etc/watchdog.conf.new
+config /etc/sysconfig/watchdog.new
+
diff --git a/system/watchdog/slack-desc b/system/watchdog/slack-desc
new file mode 100644
index 0000000000..15fc3a4bb8
--- /dev/null
+++ b/system/watchdog/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+watchdog: watchdog (the userspace daemon for watchdog support)
+watchdog:
+watchdog: watchdog is a daemon that periodically pokes a hardware chip,
+watchdog: and if it fails to do so (presumaby because the system got stuck),
+watchdog: the chip would reboot the system. A somehow working software
+watchdog: emulation of this chip, called "softdog" also exists in Linux.
+watchdog: A reboot can be triggered by some other criteria too.
+watchdog:
+watchdog:
+watchdog:
+watchdog:
diff --git a/system/watchdog/watchdog.SlackBuild b/system/watchdog/watchdog.SlackBuild
new file mode 100644
index 0000000000..3c5e994a33
--- /dev/null
+++ b/system/watchdog/watchdog.SlackBuild
@@ -0,0 +1,121 @@
+#!/bin/bash
+
+# Slackware build script for watchdog
+
+# Copyright 2022 lockywolf from somewhere
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd "$(dirname $0)" ; CWD=$(pwd)
+
+PRGNAM=watchdog
+VERSION=${VERSION:-5.16}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" -o "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --disable-static \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+mv $PKG/etc/watchdog.conf $PKG/etc/watchdog.conf.new
+mkdir -p $PKG/etc/sysconfig
+mkdir -p $PKG/etc/rc.d/init.d
+cp redhat/sysconf.redhat $PKG/etc/sysconfig/watchdog.new
+cp redhat/watchdog.init $PKG/etc/rc.d/init.d/watchdog.new
+
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -ar \
+ AUTHORS INSTALL README COPYING README.watchdog.ipmi ChangeLog examples \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/system/watchdog/watchdog.info b/system/watchdog/watchdog.info
new file mode 100644
index 0000000000..1b26e2a09c
--- /dev/null
+++ b/system/watchdog/watchdog.info
@@ -0,0 +1,10 @@
+PRGNAM="watchdog"
+VERSION="5.16"
+HOMEPAGE="https://sourceforge.net/projects/watchdog/"
+DOWNLOAD="https://prdownloads.sourceforge.net/watchdog/watchdog-5.16.tar.gz"
+MD5SUM="1b4f51cabc64d1bee2fce7cdd626831f"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="lockywolf"
+EMAIL="slackbuilds_watchdog_2022-04-03_45cc54ac-b35f-11ec-834e-cf2c364267f5@lockywolf.net"