From c59f241925916ab20263f3930302658b4f24275f Mon Sep 17 00:00:00 2001 From: Marek Srejma Date: Sun, 30 Apr 2017 21:36:22 +0700 Subject: system/incron: Updated for version 0.6.0 + new maintainer. Signed-off-by: Willy Sudiarto Raharjo --- system/incron/README | 10 +++++++ system/incron/doinst.sh | 25 +++++++++++++++++ system/incron/incron.SlackBuild | 33 ++++++++++++---------- system/incron/incron.info | 10 +++---- system/incron/rc.incrond | 62 +++++++++++++++++++++++++++++++++++++++++ system/incron/slack-desc | 2 +- 6 files changed, 121 insertions(+), 21 deletions(-) create mode 100644 system/incron/doinst.sh create mode 100644 system/incron/rc.incrond (limited to 'system/incron') diff --git a/system/incron/README b/system/incron/README index 595d6437ef..b3359c1299 100644 --- a/system/incron/README +++ b/system/incron/README @@ -3,3 +3,13 @@ a daemon and a table manipulator. You can use it a similar way as the regular cron. The difference is that the inotify cron handles filesystem events rather than time periods. +To start incrond automatically on system start, make sure that +/etc/rc.d/rc.incrond is executable and put the following line to your +/etc/rc.d/rc.local: + + [ -x /etc/rc.d/rc.incrond ] && /etc/rc.d/rc.incrond start + +To stop incrond on system shutdown, add this line to your +/etc/rc.d/rc.local_shutdown: + + [ -x /etc/rc.d/rc.incrond ] && /etc/rc.d/rc.incrond stop diff --git a/system/incron/doinst.sh b/system/incron/doinst.sh new file mode 100644 index 0000000000..56ac195452 --- /dev/null +++ b/system/incron/doinst.sh @@ -0,0 +1,25 @@ +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/rc.incrond.new diff --git a/system/incron/incron.SlackBuild b/system/incron/incron.SlackBuild index aa4573bea6..01dd2dfd36 100644 --- a/system/incron/incron.SlackBuild +++ b/system/incron/incron.SlackBuild @@ -4,15 +4,16 @@ # Written by Asaf Ohaion asaf@lingnu.com # Modified by Willy Sudiarto Raharjo +# Modified 2017 by Marek Srejma PRGNAM=incron -VERSION=${VERSION:-0.5.10} +VERSION=${VERSION:-0.6.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac @@ -23,8 +24,8 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" @@ -43,22 +44,25 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 +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 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ - -exec chmod 644 {} \; + \( -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 {} \; -sed -i '1,1i#include ' inotify-cxx.cpp icd-main.cpp -sed -i '1,1i#include ' icd-main.cpp inotify-cxx.cpp usertable.cpp appargs.cpp -sed -i 's|strchr(s,|(char*)strchr(s,|' incroncfg.cpp +sed -i 's|/share/|/|g' Makefile make PREFIX=/usr make install DESTDIR=$PKG PREFIX=/usr MANPATH=/usr/man +# Install init script: +mkdir -p $PKG/etc/rc.d +cp -a $CWD/rc.incrond $PKG/etc/rc.d/rc.incrond.new +chmod 644 $PKG/etc/rc.d/rc.incrond.new + 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 @@ -66,12 +70,11 @@ 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 -a \ - doc/html CHANGELOG COPYING README LICENSE-* TODO VERSION \ - $PKG/usr/doc/$PRGNAM-$VERSION +cp -a CHANGELOG COPYING README LICENSE-* VERSION $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install +cat $CWD/doinst.sh > $PKG/install/doinst.sh cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG diff --git a/system/incron/incron.info b/system/incron/incron.info index e1e5c0d5d8..2ac8640348 100644 --- a/system/incron/incron.info +++ b/system/incron/incron.info @@ -1,10 +1,10 @@ PRGNAM="incron" -VERSION="0.5.10" +VERSION="0.6.0" HOMEPAGE="http://inotify.aiken.cz" -DOWNLOAD="http://inotify.aiken.cz/download/incron/incron-0.5.10.tar.bz2" -MD5SUM="038190dc64568883a206f3d58269b850" +DOWNLOAD="https://github.com/danfruehauf/incron/archive/0.6.0/incron-0.6.0.tar.gz" +MD5SUM="76e072903edd1ae5a923c528669faccd" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Asaf Ohaion" -EMAIL="asaf@lingnu.com" +MAINTAINER="Marek Srejma" +EMAIL="sam_web@yahoo.de" diff --git a/system/incron/rc.incrond b/system/incron/rc.incrond new file mode 100644 index 0000000000..752d930c46 --- /dev/null +++ b/system/incron/rc.incrond @@ -0,0 +1,62 @@ +#!/bin/sh +# Start/stop/restart the inotify cron daemon (incrond). + +# Sanity check. If /usr/sbin/incrond is missing then it +# doesn't make much sense to try to run this script: +if [ ! -x /usr/sbin/incrond ]; then + printf "%s: no /usr/sbin/incrond found (or not executable); cannot start.\n" "$0" + exit 1 +fi + +# Check if incrond is running +incrond_running() { + ps axc | egrep -q " incrond$" +} + +# Start incrond. +incrond_start() { + incrond_running && { + echo "incrond is already running." + } || { + echo "Starting incrond: /usr/sbin/incrond" + /usr/sbin/incrond + } +} + +# Stop incrond (/usr/sbin/incrond): +incrond_stop() { + incrond_running && { + echo "Stopping incrond: /usr/sbin/incrond -k" + /usr/sbin/incrond -k + } || { + echo "incrond is not running." + } +} + +# Restart incrond: +incrond_restart() { + incrond_stop + incrond_start +} + +case "$1" in + 'start') + incrond_start + ;; + 'stop') + incrond_stop + ;; + 'restart') + incrond_restart + ;; + 'status') + incrond_running && { + echo "incrond is running." + } || { + echo "No running incrond process." + } + + ;; + *) + printf "usage:\n\t%s start|stop|restart|status\n" "$0" +esac diff --git a/system/incron/slack-desc b/system/incron/slack-desc index 1ee70d7098..43cdd3e987 100644 --- a/system/incron/slack-desc +++ b/system/incron/slack-desc @@ -14,6 +14,6 @@ incron: as the regular cron. The difference is that the inotify cron incron: handles filesystem events rather than time periods. incron: incron: -incron: +incron: Website: http://inotify.aiken.cz incron: incron: -- cgit v1.2.3