From ed73b57964157ec624e06d7dbf2270a168e4ab73 Mon Sep 17 00:00:00 2001 From: Richard Narron Date: Thu, 7 Aug 2014 13:08:12 +0700 Subject: system/fcron: Added (periodical command scheduler). Signed-off-by: Willy Sudiarto Raharjo --- system/fcron/README | 27 +++++++++++ system/fcron/doinst.sh | 28 +++++++++++ system/fcron/fcron.SlackBuild | 108 ++++++++++++++++++++++++++++++++++++++++++ system/fcron/fcron.info | 10 ++++ system/fcron/rc.fcron | 21 ++++++++ system/fcron/slack-desc | 19 ++++++++ 6 files changed, 213 insertions(+) create mode 100644 system/fcron/README create mode 100644 system/fcron/doinst.sh create mode 100644 system/fcron/fcron.SlackBuild create mode 100644 system/fcron/fcron.info create mode 100644 system/fcron/rc.fcron create mode 100644 system/fcron/slack-desc diff --git a/system/fcron/README b/system/fcron/README new file mode 100644 index 0000000000..d664aede05 --- /dev/null +++ b/system/fcron/README @@ -0,0 +1,27 @@ +Fcron is a periodical command scheduler which aims at replacing +Vixie Cron and Anacron. + +Fcron works well on systems that are not continuously running such +as laptops or desktops and it is loaded with features. + +When a machine is powered on, Fcron can start jobs that were +skipped while the machine was powered off. + +Installation notes: +------------------- +Group fcron and user fcron must exist before installation. +So as root do this: + groupadd -g 289 fcron + useradd -u 289 -g fcron -d /var/spool/fcron -M -s /bin/false fcron + +Post Installation notes: +------------------------ +The Fcron installation creates a startup file called /etc/rc.d/rc.fcron + +To run this startup file automatically at system startup time, +add an entry to the /etc/rc.d/rc.local file: + + # start fcron as a replacement for cron + if [ -x /etc/rc.d/rc.fcron ]; then + . /etc/rc.d/rc.fcron start + fi diff --git a/system/fcron/doinst.sh b/system/fcron/doinst.sh new file mode 100644 index 0000000000..d8651841e8 --- /dev/null +++ b/system/fcron/doinst.sh @@ -0,0 +1,28 @@ +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.fcron.new +config etc/fcron.conf.new +config etc/fcron.allow +config etc/fcron.deny diff --git a/system/fcron/fcron.SlackBuild b/system/fcron/fcron.SlackBuild new file mode 100644 index 0000000000..3caab1d06b --- /dev/null +++ b/system/fcron/fcron.SlackBuild @@ -0,0 +1,108 @@ +#!/bin/sh + +# Slackware build script for fcron + +# Written by Richard Narron (richard@aaazen.com) + +PRGNAM=fcron +VERSION=${VERSION:-3.2.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +# Select fcron's default user/group +FCRON_USER=${FCRON_USER:-fcron} +FCRON_GROUP=${FCRON_GROUP:-fcron} + +if ! getent group $FCRON_GROUP >/dev/null; then + echo "Error, the group $FCRON_GROUP does not exist." + echo "Create the group like this:" + echo " groupadd -g 289 $FCRON_GROUP" + exit 1 +fi +if ! getent passwd $FCRON_USER >/dev/null; then + echo "Error, the userid $FCRON_USER does not exist." + echo "Create the user like this:" + echo " useradd -u 289 -g $FCRON_GROUP -d /var/spool/fcron -M -s /bin/false $FCRON_USER" + exit 1 +fi + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686 -Wall" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686 -Wall" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC -Wall" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2 -Wall" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT + +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.src.tar.gz +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 {} \; + +./configure \ + --with-username=$FCRON_USER \ + --with-groupname=$FCRON_GROUP \ + --with-boot-install=no \ + --with-cflags="$SLKCFLAGS" \ + --with-docdir=/usr/doc \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --localstatedir=/var \ + --mandir=/usr/man \ + --prefix=/usr \ + --sysconfdir=/etc + +make +make install DESTDIR=$PKG + +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 + +install -D -m 0644 $CWD/rc.fcron $PKG/etc/rc.d/rc.fcron.new + +cp -a README $PKG/usr/doc/$PRGNAM-$VERSION +cp -a $CWD/README $PKG/usr/doc/$PRGNAM-$VERSION/README.slackware +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mv $PKG/etc/fcron.conf $PKG/etc/fcron.conf.new +mv $PKG/etc/fcron.deny $PKG/etc/fcron.deny.new +mv $PKG/etc/fcron.allow $PKG/etc/fcron.allow.new + +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:-tgz} diff --git a/system/fcron/fcron.info b/system/fcron/fcron.info new file mode 100644 index 0000000000..276cbe5ff8 --- /dev/null +++ b/system/fcron/fcron.info @@ -0,0 +1,10 @@ +PRGNAM="fcron" +VERSION="3.2.0" +HOMEPAGE="http://fcron.free.fr/" +DOWNLOAD="http://fcron.free.fr/archives/fcron-3.2.0.src.tar.gz" +MD5SUM="4b031c2fba32a98fa814d1557158b0e9" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Richard Narron" +EMAIL="richard@aaazen.com" diff --git a/system/fcron/rc.fcron b/system/fcron/rc.fcron new file mode 100644 index 0000000000..5c826afa44 --- /dev/null +++ b/system/fcron/rc.fcron @@ -0,0 +1,21 @@ +#!/bin/sh +# Start fcron at boot time under Slackware +# +# default configuration file is /etc/fcron.conf +# +#2014-08-04 R Narron Create for SlackBuild + +case "$1" in + start) + echo "Starting fcron" + /usr/sbin/fcron -b + ;; + stop) + echo "Stopping fcron" + killall -TERM fcron + ;; + *) + echo "Usage: fcron start|stop" + exit 1 + ;; +esac diff --git a/system/fcron/slack-desc b/system/fcron/slack-desc new file mode 100644 index 0000000000..821ff388ec --- /dev/null +++ b/system/fcron/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------------------------------------------------------| +fcron: fcron (periodical command scheduler) +fcron: +fcron: Fcron is a periodical command scheduler which aims at replacing +fcron: Vixie Cron and Anacron. +fcron: +fcron: Fcron works well on systems that are not continuously running such +fcron: as laptops or desktops and it is loaded with features. +fcron: +fcron: When a machine is powered on, Fcron can start jobs that were +fcron: skipped while the machine was powered off. +fcron: Homepage: http://fcron.free.fr/ -- cgit v1.2.3