From 816f172bcddc734a6f85a54b3d52087853c770bb Mon Sep 17 00:00:00 2001 From: Menno Duursma Date: Thu, 13 May 2010 00:42:22 +0200 Subject: system/watchdog: Updated for version 5.7 --- system/watchdog/README | 10 +--- system/watchdog/doinst.sh | 22 +++---- .../watchdog/patches/watchdog-5.7-slackware.diff | 22 +++++++ system/watchdog/rc.watchdog | 43 +++++++++++++ system/watchdog/watchdog-5.4-slackware.diff | 70 ---------------------- system/watchdog/watchdog.SlackBuild | 48 ++++++++------- system/watchdog/watchdog.info | 12 ++-- 7 files changed, 109 insertions(+), 118 deletions(-) create mode 100644 system/watchdog/patches/watchdog-5.7-slackware.diff create mode 100644 system/watchdog/rc.watchdog delete mode 100644 system/watchdog/watchdog-5.4-slackware.diff (limited to 'system') diff --git a/system/watchdog/README b/system/watchdog/README index f142f14f04..63459e151c 100644 --- a/system/watchdog/README +++ b/system/watchdog/README @@ -5,22 +5,17 @@ of it _not_ being able to do so, Linux may reset the system. For this to work, a kernel driver for the aformentioned device needs to be loaded. The module may be found in: - /lib/modules/$(uname -r)/kernel/drivers/char/watchdog + /lib/modules/`uname -r`/kernel/drivers/char/watchdog It can be configured to try and fix things (such as networking) before triggering a reboot. As 'repair.sh' may be able to do. -See the examples included in: - - /usr/doc/watchdog-5.4/examples +See the examples included in /usr/doc/watchdog-5.6/examples This package also contains the 'wd_keepalive' program by Marcel Jansen which "can be run during critical periods when the normal watcdog shouldn't be run. It will read from the same configuration file; it will do no checks but will keep writing to the device. -The watchdog was written and is maintained by Michael Meskes -(it is based on example code by Alan Cox). - To enable the watchdog: make sure a kernel module gets loaded for it (at boot) such as the 'softdog' or an actual hardware driver... Then add the following to rc.local: @@ -28,4 +23,3 @@ Then add the following to rc.local: if [ -x /etc/rc.d/rc.watchdog ]; then /etc/rc.d/rc.watchdog start fi - diff --git a/system/watchdog/doinst.sh b/system/watchdog/doinst.sh index a75147f719..9d8334e29c 100644 --- a/system/watchdog/doinst.sh +++ b/system/watchdog/doinst.sh @@ -1,5 +1,4 @@ -config() -{ +config() { NEW="$1" OLD="$(dirname $NEW)/$(basename $NEW .new)" # If there's no config file by that name, mv it over: @@ -12,18 +11,13 @@ config() # Otherwise, we leave the .new copy for the admin to consider... } -PRGNAM=watchdog - -# Keep same perms on the rc.$PRGNAM.new -if [ -e etc/rc.d/rc.$PRGNAM ]; then - cp -a etc/rc.d/rc.$PRGNAM etc/rc.d/rc.$PRGNAM.new.incoming - cat etc/rc.d/rc.$PRGNAM.new > etc/rc.d/rc.$PRGNAM.new.incoming - mv etc/rc.d/rc.$PRGNAM.new.incoming etc/rc.d/rc.$PRGNAM.new -else - # Default to executable - chmod 0755 etc/rc.d/rc.$PRGNAM.new +# Keep same perms on rc.watchdog: +if [ -e etc/rc.d/rc.watchdog ]; then + cp -a etc/rc.d/rc.watchdog etc/rc.d/rc.watchdog.new.incoming + cat etc/rc.d/rc.watchdog.new > etc/rc.d/rc.watchdog.new.incoming + mv etc/rc.d/rc.watchdog.new.incoming etc/rc.d/rc.watchdog.new fi -config etc/rc.d/rc.$PRGNAM.new -config etc/$PRGNAM.conf.new +config etc/rc.d/rc.watchdog.new +config etc/watchdog.conf.new diff --git a/system/watchdog/patches/watchdog-5.7-slackware.diff b/system/watchdog/patches/watchdog-5.7-slackware.diff new file mode 100644 index 0000000000..20bf0e3d32 --- /dev/null +++ b/system/watchdog/patches/watchdog-5.7-slackware.diff @@ -0,0 +1,22 @@ +--- watchdog-5.4.orig/examples/repair.sh 2006-07-30 05:50:06.000000000 -0500 ++++ watchdog-5.7/examples/repair.sh 2008-03-02 12:58:08.086346303 -0600 +@@ -48,6 +48,9 @@ + elif [ -x /etc/init.d/networking ]; then + # Debian + /etc/init.d/networking stop ++ elif [ -x /etc/rc.d/rc.inet1 ]; then ++ # Slackware ++ /etc/rc.d/rc.inet1 stop + else + ifconfig | + awk '/Link/ {print $1}' | +@@ -79,6 +82,9 @@ + elif [ -x /etc/rc.d/init.d/network ]; then + # Redhat + /etc/rc.d/init.d/network start ++elif [ -x /etc/rc.d/rc.inet1 ]; then ++ # Slackware ++ /etc/rc.d/rc.inet1 start + else + echo "Couldn't find network script to relaunch networking. Please edit $0" | logger -i -t repair -p daemon.info + exit $1 diff --git a/system/watchdog/rc.watchdog b/system/watchdog/rc.watchdog new file mode 100644 index 0000000000..7e07dff61f --- /dev/null +++ b/system/watchdog/rc.watchdog @@ -0,0 +1,43 @@ +#!/bin/sh +# +# /etc/rc.d/rc.watchdog +# +# Start/stop/restart the watchdog timer service. + +watchdog_start() { + if [ ! -e /dev/watchdog ]; then + echo "$0: No /dev/watchdog device node seems to exist on this system." + echo "$0: A kernel module probably needs to be loaded; please see:" + echo "$0: /usr/src/linux/Documentation/watchdog/watchdog-api.txt" + exit 0 + fi + if [ -x /usr/sbin/watchdog -a -r /etc/watchdog.conf ]; then + echo "Starting the watchdog timer service: /usr/sbin/watchdog" + /usr/sbin/watchdog + fi +} + +watchdog_stop() { + killall watchdog +} + +watchdog_restart() { + watchdog_stop + sleep 10 # can take a while to die + watchdog_start +} + +case "$1" in +'start') + watchdog_start + ;; +'stop') + watchdog_stop + ;; +'restart') + watchdog_restart + ;; +*) + echo $"Usage: $0 {start|stop|restart}" +esac + diff --git a/system/watchdog/watchdog-5.4-slackware.diff b/system/watchdog/watchdog-5.4-slackware.diff deleted file mode 100644 index fc2caca4e4..0000000000 --- a/system/watchdog/watchdog-5.4-slackware.diff +++ /dev/null @@ -1,70 +0,0 @@ -diff -Nur watchdog-5.4.orig/examples/repair.sh watchdog-5.4/examples/repair.sh ---- watchdog-5.4.orig/examples/repair.sh 2006-07-30 05:50:06.000000000 -0500 -+++ watchdog-5.4/examples/repair.sh 2008-03-02 12:58:08.086346303 -0600 -@@ -48,6 +48,9 @@ - elif [ -x /etc/init.d/networking ]; then - # Debian - /etc/init.d/networking stop -+ elif [ -x /etc/rc.d/rc.inet1 ]; then -+ # Slackware -+ /etc/rc.d/rc.inet1 stop - else - ifconfig | - awk '/Link/ {print $1}' | -@@ -79,6 +82,9 @@ - elif [ -x /etc/rc.d/init.d/network ]; then - # Redhat - /etc/rc.d/init.d/network start -+elif [ -x /etc/rc.d/rc.inet1 ]; then -+ # Slackware -+ /etc/rc.d/rc.inet1 start - else - echo "Couldn't find network script to relaunch networking. Please edit $0" | logger -i -t repair -p daemon.info - exit $1 -diff -Nur watchdog-5.4.orig/rc.watchdog.slackware watchdog-5.4/rc.watchdog.slackware ---- watchdog-5.4.orig/rc.watchdog.slackware 1969-12-31 18:00:00.000000000 -0600 -+++ watchdog-5.4/rc.watchdog.slackware 2008-03-02 12:58:08.086346303 -0600 -@@ -0,0 +1,43 @@ -+#!/bin/sh -+# -+# /etc/rc.d/rc.watchdog -+# -+# Start/stop/restart the watchdog timer service. -+ -+watchdog_start() { -+ if [ ! -e /dev/watchdog ]; then -+ echo "$0: No /dev/watchdog device node seems to exist on this system." -+ echo "$0: A kernel module probably needs to be loaded; please see:" -+ echo "$0: /usr/src/linux/Documentation/watchdog/watchdog-api.txt" -+ exit 0 -+ fi -+ if [ -x /usr/sbin/watchdog -a -r /etc/watchdog.conf ]; then -+ echo "Starting the watchdog timer service: /usr/sbin/watchdog" -+ /usr/sbin/watchdog -+ fi -+} -+ -+watchdog_stop() { -+ killall watchdog -+} -+ -+watchdog_restart() { -+ watchdog_stop -+ sleep 10 # can take a while to die -+ watchdog_start -+} -+ -+case "$1" in -+'start') -+ watchdog_start -+ ;; -+'stop') -+ watchdog_stop -+ ;; -+'restart') -+ watchdog_restart -+ ;; -+*) -+ echo $"Usage: $0 {start|stop|restart}" -+esac -+ diff --git a/system/watchdog/watchdog.SlackBuild b/system/watchdog/watchdog.SlackBuild index ae901d5401..1b5a8649dc 100644 --- a/system/watchdog/watchdog.SlackBuild +++ b/system/watchdog/watchdog.SlackBuild @@ -1,10 +1,15 @@ #!/bin/sh # Slackware build script for watchdog -# Written by Menno E. Duursma + +# Written by Menno Duursma + +# This program is free software. It comes without any warranty. +# Granted WTFPL, Version 2, as published by Sam Hocevar. See +# http://sam.zoy.org/wtfpl/COPYING for more details. PRGNAM=watchdog -VERSION=5.4 +VERSION=${VERSION:-5.7} ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -16,8 +21,13 @@ OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" fi set -e # Exit on most errors @@ -26,26 +36,35 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xvf $CWD/${PRGNAM}-${VERSION}.tar.gz +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION chown -R root:root . chmod -R u+w,go+r-w,a-s . # Apply the Slackware support scripts patch -patch -p1 < $CWD/$PRGNAM-$VERSION-slackware.diff +patch -p1 --verbose < $CWD/patches/$PRGNAM-$VERSION-slackware.diff CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ --sysconfdir=/etc \ --localstatedir=/var \ - --mandir=/usr/man + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --build=$ARCH-slackware-linux -# Compile the application and install it into the $PKG directory make make install-strip DESTDIR=$PKG +# Move config to .new; let doinst.sh handle it further +mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new + +# Add init script too +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new + # Compress man pages ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; @@ -59,24 +78,11 @@ cp -a [A-Z][A-Z]* ChangeLog examples $PKG/usr/doc/$PRGNAM-$VERSION cp -a debian/README.debian $PKG/usr/doc/$PRGNAM-$VERSION # Also, include the SlackBuild script in the documentation directory cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild -cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo - -# Move config to .new; let doinst.sh handle it further -mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new - -# Add init script too -mkdir -p $PKG/etc/rc.d -cat rc.$PRGNAM.slackware > $PKG/etc/rc.d/rc.$PRGNAM.new +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG 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.tgz - -# Clean up the extra stuff: -if [ "$1" = "--cleanup" ]; then - rm -rf $TMP/$PRGNAM-$VERSION - rm -rf $PKG -fi +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/watchdog/watchdog.info b/system/watchdog/watchdog.info index 55ca07d78a..5ade6b5e3e 100644 --- a/system/watchdog/watchdog.info +++ b/system/watchdog/watchdog.info @@ -1,8 +1,10 @@ PRGNAM="watchdog" -VERSION="5.4" +VERSION="5.7" HOMEPAGE="http://sourceforge.net/projects/watchdog" -DOWNLOAD="http://www.ibiblio.org/pub/Linux/system/daemons/watchdog/watchdog-5.4.tar.gz" -MD5SUM="66480128b9dabcced2e4c8db3e60fa50" -MAINTAINER="Menno E. Duursma" +DOWNLOAD="http://www.ibiblio.org/pub/Linux/system/daemons/watchdog/watchdog-5.7.tar.gz" +MD5SUM="31766450ecfc9aff70fe966c0b9df06d" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Menno Duursma" EMAIL="druiloor@zonnet.nl" -APPROVED="rworkman" +APPROVED="Erik Hanson" -- cgit v1.2.3