From 1ef6179b351e630270855c1442c3432643e6beac Mon Sep 17 00:00:00 2001
From: Cecil <knoppmyth@gmail.com>
Date: Mon, 4 Jul 2011 20:10:33 -0700
Subject: dcron:Bumped to latest.

---
 abs/core/dcron/PKGBUILD            | 72 ++++++++++++++++++++++----------------
 abs/core/dcron/dcron-logname.patch | 25 +++++++++++++
 abs/core/dcron/dcron.conf.d        |  4 +++
 abs/core/dcron/dcron.install       | 10 ++++++
 abs/core/dcron/dcron.rc.d          | 47 +++++++++++++++++++++++++
 5 files changed, 128 insertions(+), 30 deletions(-)
 create mode 100644 abs/core/dcron/dcron-logname.patch
 create mode 100644 abs/core/dcron/dcron.conf.d
 create mode 100644 abs/core/dcron/dcron.install
 create mode 100644 abs/core/dcron/dcron.rc.d

diff --git a/abs/core/dcron/PKGBUILD b/abs/core/dcron/PKGBUILD
index e5a46d8..61999c9 100644
--- a/abs/core/dcron/PKGBUILD
+++ b/abs/core/dcron/PKGBUILD
@@ -1,38 +1,50 @@
-# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
-# Maintainer: judd <jvinet@zeroflux.org>
+# Maintainer: Paul Mattal <paul.archlinux.org>
+
 pkgname=dcron
-pkgver=3.2
-pkgrel=12
-pkgdesc="Dillon's Cron Daemon"
+pkgver=4.4
+pkgrel=2
+pkgdesc="dillon's lightweight cron daemon"
 arch=(i686 x86_64)
 license=('GPL')
-groups=('base')
-url="http://apollo.backplane.com/FreeSrc/"
-backup=(var/spool/cron/root)
+url="http://www.jimpryor.net/linux/dcron"
+backup=(var/spool/cron/root etc/conf.d/crond)
 depends=('glibc')
 provides=('cron')
-source=(http://apollo.backplane.com/FreeSrc/dcron32.tgz
-	dcron-3.1.patch
-	root.crontab
-	crond
-	crond.logrotate
-	run-cron)
-md5sums=('c2c816deb389b4bfb00761f26afe3efd' '2f0c3f7497a12c8826c9be3f87843fcd'\
-         '7fcc06b13708ebd667711b1fbf62ee6e' 'd7edac165ef19ebb9d0089bdc218b53a'\
-         'aeabcd5e4924d1a7593c8782d1068c86' '5ff0cdcb9ec99778938ac6ef26800327')
+groups=('base')
+source=("http://www.jimpryor.net/linux/releases/${pkgname}-${pkgver}.tar.gz"
+	'dcron-logname.patch'
+	'dcron.rc.d'
+	'dcron.conf.d')
+md5sums=('02d848ba043a9df5bf2102a9f4bc04bd'
+	 'c6054421b48100f7a2a7a36e2d33c92a'
+	 '73693cdd59df526e729cdec99c5ed8fb'
+	 '5bfa07beb54d0beaf3f38225e4d5a9fa')
+optdepends=('smtp-server: sending cron job output via email')
+install=$pkgname.install
 
 build() {
-  cd $startdir/src/dcron
-  patch -Np1 -i ../dcron-3.1.patch || return 1
-  make || return 1
-  install -D -m4755 crontab $startdir/pkg/usr/bin/crontab
-  install -D -m755 crond $startdir/pkg/usr/sbin/crond
-  install -D -m644 crontab.1 $startdir/pkg/usr/man/man1/crontab.1
-  install -D -m644 crond.8 $startdir/pkg/usr/man/man8/crond.8
-  mkdir -p $startdir/pkg/var/spool/cron $startdir/pkg/etc/cron.d
-  mkdir -p $startdir/pkg/etc/{rc.d,cron.hourly,cron.daily,cron.weekly,cron.monthly}
-  install -D -m0600 ../root.crontab $startdir/pkg/var/spool/cron/root
-  install -D -m755 ../crond $startdir/pkg/etc/rc.d/crond
-  install -D -m644 ../crond.logrotate $startdir/pkg/etc/logrotate.d/crond
-  install -D -m755 ../run-cron $startdir/pkg/usr/sbin/run-cron
+	cd "$srcdir/${pkgname}-${pkgver}" || return 1
+
+	# patch to add LOGNAME environment variable
+	patch -p1 -i $srcdir/dcron-logname.patch || return 1
+
+	# by default, any member of group "users" can edit their own crontab
+	make \
+		PREFIX=/usr \
+		CRONTAB_GROUP=users \
+		CRONTABS=/var/spool/cron \
+		CRONSTAMPS=/var/spool/cronstamps \
+		|| return 1
+	make DESTDIR="$pkgdir" install || return 1
+
+	# install standard configuration and scripts
+	install -d -m755 "$pkgdir/etc/cron."{hourly,daily,weekly,monthly} \
+		|| return 1
+	install -D -m755 extra/run-cron "$pkgdir/usr/sbin/run-cron" || return 1
+	install -D -m0600 extra/root.crontab "$pkgdir/var/spool/cron/root" \
+		|| return 1
+
+	# install Arch configuration and launch scripts
+	install -D -m755 "$srcdir/dcron.rc.d" "$pkgdir/etc/rc.d/crond" || return 1
+	install -D -m0644 "$srcdir/dcron.conf.d" "$pkgdir/etc/conf.d/crond" || return 1
 }
diff --git a/abs/core/dcron/dcron-logname.patch b/abs/core/dcron/dcron-logname.patch
new file mode 100644
index 0000000..c37c5f4
--- /dev/null
+++ b/abs/core/dcron/dcron-logname.patch
@@ -0,0 +1,25 @@
+diff -aur dcron-4.4/chuser.c dcron-4.4.logname/chuser.c
+--- dcron-4.4/chuser.c	2010-02-15 11:18:13.111967483 +0100
++++ dcron-4.4.logname/chuser.c	2010-02-15 11:18:29.615531204 +0100
+@@ -25,6 +25,7 @@
+ 		return(-1);
+ 	}
+ 	setenv("USER", pas->pw_name, 1);
++	setenv("LOGNAME", pas->pw_name, 1);
+ 	setenv("HOME", pas->pw_dir, 1);
+ 	setenv("SHELL", "/bin/sh", 1);
+ 
+diff -aur dcron-4.4/crontab.1 dcron-4.4.logname/crontab.1
+--- dcron-4.4/crontab.1	2010-02-15 11:18:13.111967483 +0100
++++ dcron-4.4.logname/crontab.1	2010-02-15 11:19:48.295707950 +0100
+@@ -57,8 +57,8 @@
+ .PP
+ Nor does it do any special environment handling.
+ A shell script is better-suited to doing that than a cron daemon.
+-This cron daemon sets up only three environment variables: USER,
+-HOME, and SHELL.
++This cron daemon sets up only four environment variables: USER,
++LOGNAME, HOME, and SHELL.
+ .PP
+ Our crontab format is roughly similar to that used by vixiecron.
+ Individual fields may contain a time, a time range, a time range
diff --git a/abs/core/dcron/dcron.conf.d b/abs/core/dcron/dcron.conf.d
new file mode 100644
index 0000000..763c712
--- /dev/null
+++ b/abs/core/dcron/dcron.conf.d
@@ -0,0 +1,4 @@
+#
+# Parameters to be passed to crond
+#
+CROND_ARGS="-S -l info"
diff --git a/abs/core/dcron/dcron.install b/abs/core/dcron/dcron.install
new file mode 100644
index 0000000..ba08b3a
--- /dev/null
+++ b/abs/core/dcron/dcron.install
@@ -0,0 +1,10 @@
+## arg 1:  the new package version
+## arg 2:  the old package version
+post_upgrade() {
+  if [ "`vercmp $2 4.0`" -lt 0 ]
+  then
+    echo "Restart crond, since you're upgrading to the dcron 4.x series."
+  fi
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/abs/core/dcron/dcron.rc.d b/abs/core/dcron/dcron.rc.d
new file mode 100644
index 0000000..b1a5770
--- /dev/null
+++ b/abs/core/dcron/dcron.rc.d
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/crond
+
+PID=$(pidof -o %PPID /usr/sbin/crond)
+case $1 in
+start)
+	stat_busy "Starting Cron Daemon"
+
+	# defaults to using syslog, and sendmail-ing cron output to local user
+	# to mail output to remote address instead, add "-m user@host"
+	# to CROND_ARGS in /etc/conf.d/crond
+	if [[ -z $PID ]] && /usr/sbin/crond $CROND_ARGS; then
+
+		PID=$(pidof -o %PPID /usr/sbin/crond)
+		echo "$PID" > /var/run/crond.pid
+		add_daemon crond
+		stat_done
+	else
+		stat_fail
+		exit 1
+	fi
+	;;
+
+stop)
+	stat_busy "Stopping Cron Daemon"
+	if [[ ! -z $PID ]]  && kill "$PID" &>/dev/null; then
+		rm_daemon crond
+		stat_done
+	else
+		stat_fail
+		exit 1
+	fi
+	;;
+
+restart)
+	$0 stop
+	$0 start
+	;;
+
+*)
+	echo "Usage: $0 {start|stop|restart}" >&2
+	exit 1
+
+esac
-- 
cgit v0.12