From 14fd9e26c6d870d3df13f90e203fd73c1fb73cc3 Mon Sep 17 00:00:00 2001 From: lockywolf Date: Wed, 6 Apr 2022 17:44:37 +0700 Subject: system/watchdog: Moved from python. Signed-off-by: Willy Sudiarto Raharjo --- python/watchdog/README | 1 - python/watchdog/slack-desc | 19 ------ python/watchdog/watchdog.SlackBuild | 88 -------------------------- python/watchdog/watchdog.info | 10 --- system/watchdog/README | 15 +++++ system/watchdog/doinst.sh | 31 +++++++++ system/watchdog/slack-desc | 19 ++++++ system/watchdog/watchdog.SlackBuild | 121 ++++++++++++++++++++++++++++++++++++ system/watchdog/watchdog.info | 10 +++ 9 files changed, 196 insertions(+), 118 deletions(-) delete mode 100644 python/watchdog/README delete mode 100644 python/watchdog/slack-desc delete mode 100644 python/watchdog/watchdog.SlackBuild delete mode 100644 python/watchdog/watchdog.info create mode 100644 system/watchdog/README create mode 100644 system/watchdog/doinst.sh create mode 100644 system/watchdog/slack-desc create mode 100644 system/watchdog/watchdog.SlackBuild create mode 100644 system/watchdog/watchdog.info diff --git a/python/watchdog/README b/python/watchdog/README deleted file mode 100644 index c91bfe7cd6eaf..0000000000000 --- a/python/watchdog/README +++ /dev/null @@ -1 +0,0 @@ -Python API and shell utilities to monitor file system events. diff --git a/python/watchdog/slack-desc b/python/watchdog/slack-desc deleted file mode 100644 index 1b93fae280905..0000000000000 --- a/python/watchdog/slack-desc +++ /dev/null @@ -1,19 +0,0 @@ -# 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 (Filesystem events monitoring) -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: -watchdog: -watchdog: Homepage: https://pypi.org/project/watchdog/ -watchdog: diff --git a/python/watchdog/watchdog.SlackBuild b/python/watchdog/watchdog.SlackBuild deleted file mode 100644 index c4cd80b06b926..0000000000000 --- a/python/watchdog/watchdog.SlackBuild +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -# SlackBuild build script for watchdog - -# Copyright (c) 2000-2020 Prof. Horstmann -# 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 -SRCPKG=${SRCPKG-watchdog} -VERSION=${VERSION:-0.10.4} -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 ;; - arm*) ARCH=arm ;; - *) ARCH=$( uname -m ) ;; - 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} -PKG=$TMP/package-$PRGNAM -OUTPUT=${OUTPUT:-/tmp} - -set -e - -rm -rf $PKG -mkdir -p $TMP $PKG -cd $TMP -rm -rf $SRCNAM-$VERSION -tar xvf $CWD/$SRCNAM-$VERSION.tar.gz -cd $SRCNAM-$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 {} \; - -# 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 - -python3 setup.py install --root=$PKG - -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a PKG-INFO $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 - -cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/python/watchdog/watchdog.info b/python/watchdog/watchdog.info deleted file mode 100644 index 4bf2b5701b3f9..0000000000000 --- a/python/watchdog/watchdog.info +++ /dev/null @@ -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" diff --git a/system/watchdog/README b/system/watchdog/README new file mode 100644 index 0000000000000..d39c8c35abe49 --- /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 0000000000000..c6ba0557df5f9 --- /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 0000000000000..15fc3a4bb82c1 --- /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 0000000000000..3c5e994a335a5 --- /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 0000000000000..1b26e2a09ccad --- /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" -- cgit v1.2.3