Subject: [alpine-aports] [PATCH] testing/dcron: new aport

From: Sören Tempel <[email-masked]>
Date: Thu, 24 Sep 2015 17:16:29 +0200

---
 testing/dcron/APKBUILD    | 50 +++++++++++++++++++++++++++++++++++++++++++++++
 testing/dcron/dcron.confd |  5 +++++
 testing/dcron/dcron.initd | 24 +++++++++++++++++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 testing/dcron/APKBUILD
 create mode 100644 testing/dcron/dcron.confd
 create mode 100644 testing/dcron/dcron.initd

diff --git a/testing/dcron/APKBUILD b/testing/dcron/APKBUILD
new file mode 100644
index 0000000..b731f08
--- /dev/null
+++ b/testing/dcron/APKBUILD
@@ -0,0 +1,50 @@
+# Contributor: Sören Tempel <[email-masked]>
+# Maintainer: Sören Tempel <[email-masked]>
+pkgname=dcron
+pkgver=4.5
+pkgrel=0
+pkgdesc="dillon's lightweight cron daemon"
+url="http://www.jimpryor.net/linux/dcron.html"
+arch="all"
+license="GPL"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-doc"
+source="http://www.jimpryor.net/linux/releases/${pkgname}-${pkgver}.tar.gz
+	$pkgname.initd
+	$pkgname.confd"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+build() {
+	cd "$_builddir"
+	make PREFIX=/usr \
+		CRONTAB_GROUP=wheel \
+		CRONTABS=/etc/crontabs \
+		CRONSTAMPS=/var/spool/cron/cronstamps \
+		SCRONTABS=/etc/periodic || return 1
+}
+
+package() {
+	cd "$_builddir"
+
+	make DESTDIR="$pkgdir" install || return 1
+	install -Dm644 extra/crond.logrotate "$pkgdir"/etc/logrotate.d/$pkgname || return 1
+
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname || return 1
+	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname || return 1
+
+	install -Dm644 CHANGELOG "$pkgdir"/usr/share/doc/$pkgname/CHANGELOG || return 1
+	install -Dm644 README "$pkgdir"/usr/share/doc/$pkgname/README || return 1
+}
+
+md5sums="078833f3281f96944fc30392b1888326  dcron-4.5.tar.gz
+b5f663560fabc08250e9cc53b74cdee1  dcron.initd
+a9f3fdab61f1646cbc074e6d59364303  dcron.confd"
+sha256sums="9e50edb6f5bd8153b16bad05087d985e5153ce45cc01ae77e7f842213fb4a824  dcron-4.5.tar.gz
+f48b26fc1eacff7298c2f3e2e2a3144280429785c6a067fbe66c71976a9fea1c  dcron.initd
+1e273164865bb8f05d97ef1479c285b86f4104951ac294af883eb65ce100ccd0  dcron.confd"
+sha512sums="08521391d16ba5adf80278ec2a734319c26c48841fd94b119c0b27d744c2cfb3562b1a3630135a03d1c43b1668d49262713abb20ff5f7ecd397a2a19a2f6105a  dcron-4.5.tar.gz
+a419f63ebcd6193e8a5008039ac8f14c4f4400ef95732161c07b754a8d9f0a7dda1f188778a6ee6d364822d371bcfb718dea4902d59779d00181ea2354185bd6  dcron.initd
+05b4a7aeb9d994aa3a37a0f2efa0f560a4eb6dd1fc77d67c85be3397f077bc92a0d647140164a96d48e49b486eef021aef5c3410704d457eda5eb894b46d26fb  dcron.confd"
diff --git a/testing/dcron/dcron.confd b/testing/dcron/dcron.confd
new file mode 100644
index 0000000..61cdf12
--- /dev/null
+++ b/testing/dcron/dcron.confd
@@ -0,0 +1,5 @@
+# /etc/conf.d/dcron
+
+# Options to pass to dcron at startup.
+# Default logging is via syslog; use -L to send to file.
+DCRON_OPTS=""
diff --git a/testing/dcron/dcron.initd b/testing/dcron/dcron.initd
new file mode 100644
index 0000000..9fca37f
--- /dev/null
+++ b/testing/dcron/dcron.initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/dcron/files/dcron.init-4.5,v 1.1 2011/05/16 20:28:54 vapier Exp $
+
+depend() {
+	use logger clock hostname
+	provide cron
+}
+
+start() {
+	ebegin "Starting ${SVCNAME}"
+	/usr/sbin/crond ${DCRON_OPTS}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --quiet \
+		--pidfile /var/run/crond.pid --exec /usr/sbin/crond
+	local ret=$?
+	rm -f /var/run/crond.pid
+	eend ${ret}
+}
-- 
2.5.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Sören Tempel <[email-masked]>
Date: Thu, 24 Sep 2015 17:24:04 +0200

---
 testing/dcron/APKBUILD      | 68 +++++++++++++++++++++++++++++++++++++++++++++
 testing/dcron/dcron.confd   |  5 ++++
 testing/dcron/dcron.initd   | 24 ++++++++++++++++
 testing/dcron/ldflags.patch | 38 +++++++++++++++++++++++++
 testing/dcron/pidfile.patch | 43 ++++++++++++++++++++++++++++
 5 files changed, 178 insertions(+)
 create mode 100644 testing/dcron/APKBUILD
 create mode 100644 testing/dcron/dcron.confd
 create mode 100644 testing/dcron/dcron.initd
 create mode 100644 testing/dcron/ldflags.patch
 create mode 100644 testing/dcron/pidfile.patch

diff --git a/testing/dcron/APKBUILD b/testing/dcron/APKBUILD
new file mode 100644
index 0000000..8aeffff
--- /dev/null
+++ b/testing/dcron/APKBUILD
@@ -0,0 +1,68 @@
+# Contributor: Sören Tempel <[email-masked]>
+# Maintainer: Sören Tempel <[email-masked]>
+pkgname=dcron
+pkgver=4.5
+pkgrel=0
+pkgdesc="dillon's lightweight cron daemon"
+url="http://www.jimpryor.net/linux/dcron.html"
+arch="all"
+license="GPL"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-doc"
+source="http://www.jimpryor.net/linux/releases/${pkgname}-${pkgver}.tar.gz
+	$pkgname.initd
+	$pkgname.confd
+	pidfile.patch
+	ldflags.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+	cd "$_builddir"
+	local i
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1 ;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	make PREFIX=/usr \
+		CRONTAB_GROUP=wheel \
+		CRONTABS=/etc/crontabs \
+		CRONSTAMPS=/var/spool/cron/cronstamps \
+		SCRONTABS=/etc/periodic || return 1
+}
+
+package() {
+	cd "$_builddir"
+
+	make DESTDIR="$pkgdir" install || return 1
+	install -Dm644 extra/crond.logrotate "$pkgdir"/etc/logrotate.d/$pkgname || return 1
+
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname || return 1
+	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname || return 1
+
+	install -Dm644 CHANGELOG "$pkgdir"/usr/share/doc/$pkgname/CHANGELOG || return 1
+	install -Dm644 README "$pkgdir"/usr/share/doc/$pkgname/README || return 1
+}
+
+md5sums="078833f3281f96944fc30392b1888326  dcron-4.5.tar.gz
+b5f663560fabc08250e9cc53b74cdee1  dcron.initd
+a9f3fdab61f1646cbc074e6d59364303  dcron.confd
+1e40cbf27604072f147ec8b131988eaf  pidfile.patch
+646b16f31abbea4c215512f58f421abc  ldflags.patch"
+sha256sums="9e50edb6f5bd8153b16bad05087d985e5153ce45cc01ae77e7f842213fb4a824  dcron-4.5.tar.gz
+f48b26fc1eacff7298c2f3e2e2a3144280429785c6a067fbe66c71976a9fea1c  dcron.initd
+1e273164865bb8f05d97ef1479c285b86f4104951ac294af883eb65ce100ccd0  dcron.confd
+4272467e432eab948f6770ea639f38817123eac2c87fc76f3fcb2b2d4cecbbb6  pidfile.patch
+69b907a89d22bcff5ded7ebd749c4e8df87106e290c75110630031e75631ee3a  ldflags.patch"
+sha512sums="08521391d16ba5adf80278ec2a734319c26c48841fd94b119c0b27d744c2cfb3562b1a3630135a03d1c43b1668d49262713abb20ff5f7ecd397a2a19a2f6105a  dcron-4.5.tar.gz
+a419f63ebcd6193e8a5008039ac8f14c4f4400ef95732161c07b754a8d9f0a7dda1f188778a6ee6d364822d371bcfb718dea4902d59779d00181ea2354185bd6  dcron.initd
+05b4a7aeb9d994aa3a37a0f2efa0f560a4eb6dd1fc77d67c85be3397f077bc92a0d647140164a96d48e49b486eef021aef5c3410704d457eda5eb894b46d26fb  dcron.confd
+08bd8d7445b597a5c7d66d3e768c943388db44e0ae43a0cec2be3b0c83c510f00f808b02d52b86cb663e79ea66584b16f92eaa02d40489e5f4124206ae17378d  pidfile.patch
+8a07ccfae80468a555e8f5ea60f88dd444a3aacb6baa6f747a6a02bcdce78baaa8aaf799ae9d2684a518bfff537dc0cdcf0b53bb6fc0017fa52228f1f0a16e49  ldflags.patch"
diff --git a/testing/dcron/dcron.confd b/testing/dcron/dcron.confd
new file mode 100644
index 0000000..61cdf12
--- /dev/null
+++ b/testing/dcron/dcron.confd
@@ -0,0 +1,5 @@
+# /etc/conf.d/dcron
+
+# Options to pass to dcron at startup.
+# Default logging is via syslog; use -L to send to file.
+DCRON_OPTS=""
diff --git a/testing/dcron/dcron.initd b/testing/dcron/dcron.initd
new file mode 100644
index 0000000..9fca37f
--- /dev/null
+++ b/testing/dcron/dcron.initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/dcron/files/dcron.init-4.5,v 1.1 2011/05/16 20:28:54 vapier Exp $
+
+depend() {
+	use logger clock hostname
+	provide cron
+}
+
+start() {
+	ebegin "Starting ${SVCNAME}"
+	/usr/sbin/crond ${DCRON_OPTS}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --quiet \
+		--pidfile /var/run/crond.pid --exec /usr/sbin/crond
+	local ret=$?
+	rm -f /var/run/crond.pid
+	eend ${ret}
+}
diff --git a/testing/dcron/ldflags.patch b/testing/dcron/ldflags.patch
new file mode 100644
index 0000000..7fa2d8d
--- /dev/null
+++ b/testing/dcron/ldflags.patch
@@ -0,0 +1,38 @@
+From 8a292168e584c50808b80df3577a7d89fa32db26 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <[email-masked]>
+Date: Mon, 16 May 2011 16:24:20 -0400
+Subject: [PATCH] drop LDFLAGS set, and restore CFLAGS linking
+
+Signed-off-by: Mike Frysinger <[email-masked]>
+---
+ Makefile |    5 ++---
+ 1 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1938e05..8309ad6 100644
+--- a/Makefile
++++ b/Makefile
+@@ -32,7 +32,6 @@ TABSRCS = crontab.c chuser.c
+ TABOBJS = crontab.o chuser.o
+ PROTOS = protos.h
+ LIBS =
+-LDFLAGS =
+ DEFS =  -DVERSION='"$(VERSION)"' \
+ 		-DSCRONTABS='"$(SCRONTABS)"' -DCRONTABS='"$(CRONTABS)"' \
+ 		-DCRONSTAMPS='"$(CRONSTAMPS)"' -DLOG_IDENT='"$(LOG_IDENT)"' \
+@@ -54,10 +53,10 @@ protos.h: $(SRCS) $(TABSRCS)
+ 	fgrep -h Prototype $(SRCS) $(TABSRCS) > protos.h
+ 
+ crond: $(OBJS)
+-	$(CC) $(LDFLAGS) $^ $(LIBS) -o crond
++	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o crond
+ 
+ crontab: $(TABOBJS)
+-	$(CC) $(LDFLAGS) $^ -o crontab
++	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o crontab
+ 
+ %.o: %.c defs.h $(PROTOS)
+ 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $(DEFS) $< -o $@
+-- 
+1.7.5.rc3
+
diff --git a/testing/dcron/pidfile.patch b/testing/dcron/pidfile.patch
new file mode 100644
index 0000000..6004c4c
--- /dev/null
+++ b/testing/dcron/pidfile.patch
@@ -0,0 +1,43 @@
+From 14b0f33ebf33d3d08427fd4d9fd4bda3cc107bd0 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <[email-masked]>
+Date: Tue, 26 Oct 2010 01:42:32 -0400
+Subject: [PATCH] crond: write a pid file
+
+Signed-off-by: Mike Frysinger <[email-masked]>
+---
+ Makefile |    2 +-
+ main.c   |    5 +++++
+ 2 files changed, 6 insertions(+), 1 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index dc5b78f..e278312 100644
+--- a/Makefile
++++ b/Makefile
+@@ -38,7 +38,7 @@ DEFS =  -DVERSION='"$(VERSION)"' \
+ 		-DTIMESTAMP_FMT='"$(TIMESTAMP_FMT)"'
+ 
+ # save variables needed for `make install` in config
+-all: $(PROTOS) crond crontab ;
++all: crond crontab ;
+ 	rm -f config
+ 	echo "PREFIX = $(PREFIX)" >> config
+ 	echo "SBINDIR = $(SBINDIR)" >> config
+diff --git a/main.c b/main.c
+index e4a742e..6313213 100644
+--- a/main.c
++++ b/main.c
+@@ -227,6 +227,11 @@ main(int ac, char **av)
+ 			exit(1);
+ 		} else if (pid > 0) {
+ 			/* parent */
++			FILE *fp;
++			if ((fp = fopen("/var/run/crond.pid", "w")) != NULL) {
++				fprintf(fp, "%d\n", pid);
++				fclose(fp);
++			}
+ 			exit(0);
+ 		}
+ 		/* child continues */
+-- 
+1.7.3.1
+
-- 
2.5.3

---