system/watchdog: Moved from python.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
lockywolf 2022-04-06 17:44:37 +07:00 committed by Willy Sudiarto Raharjo
parent e0869634d3
commit 14fd9e26c6
No known key found for this signature in database
GPG key ID: 3F617144D7238786
7 changed files with 118 additions and 40 deletions

View file

@ -1 +0,0 @@
Python API and shell utilities to monitor file system events.

View file

@ -1,10 +0,0 @@
PRGNAM="watchdog"
VERSION="0.10.4"
HOMEPAGE="https://pypi.org/project/watchdog/"
DOWNLOAD="https://files.pythonhosted.org/packages/6f/10/500580a0987363a0d9e1f3dd5cb1bba94a47e19266c6ce9dfb6cdd455758/watchdog-0.10.4.tar.gz"
MD5SUM="d8fba5e25277520b65ca55952ae1341b"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="pathtools3"
MAINTAINER="Prof. HORSTMANN"
EMAIL="wmh@eipg.fr"

15
system/watchdog/README Normal file
View file

@ -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.

31
system/watchdog/doinst.sh Normal file
View file

@ -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

View file

@ -6,14 +6,14 @@
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
watchdog: watchdog (Filesystem events monitoring)
watchdog: watchdog (the userspace daemon for watchdog support)
watchdog:
watchdog: Python API and shell utilities to monitor file system events.
watchdog:
watchdog: Works on Python 2.7 and 3.4+. If you want to use an old version of
watchdog: Python, you should stick with watchdog < 0.10.0.
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: Homepage: https://pypi.org/project/watchdog/
watchdog:

View file

@ -1,8 +1,8 @@
#!/bin/bash
# SlackBuild build script for watchdog
# Slackware build script for watchdog
# Copyright (c) 2000-2020 Prof. Horstmann <wmh (at) eipg.fr>
# Copyright 2022 lockywolf from somewhere
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -22,17 +22,14 @@
# 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)
cd "$(dirname $0)" ; CWD=$(pwd)
PRGNAM=watchdog
SRCPKG=${SRCPKG-watchdog}
VERSION=${VERSION:-0.10.4}
VERSION=${VERSION:-5.16}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
SRCNAM="$(printf $SRCPKG | cut -d- -f2-)"
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
@ -41,26 +38,37 @@ if [ -z "$ARCH" ]; then
esac
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp}
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
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
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 \
@ -68,21 +76,46 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Python 2.7 will be droped in the future.
if $(python2 -c 'import sys' 2>/dev/null); then
python2 setup.py install --root=$PKG
else
python setup.py install --root=$PKG
fi
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
python3 setup.py install --root=$PKG
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a PKG-INFO $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

View file

@ -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"