# Template file for 'dcron'
pkgname=dcron
version=4.4
revision=1
patch_args="-Np1"
distfiles="http://www.jimpryor.net/linux/releases/dcron-${version}.tar.gz"
build_style=custom-install
short_desc="Dillon's lightweight cron daemon"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=0847dee3a76ba504f2f1587038fef5193b143988c96bf3fdc511abd23099cb66
long_desc="
 This lightweight cron daemon aims to be simple and secure, with just enough
 features to stay useful. It was written from scratch by Matt Dillon in 1994.
 It's now developed and maintained by Jim Pryor.

 In the author's opinion, having to combine a cron daemon with another daemon
 like anacron makes for too much complexity. So the goal is a simple cron daemon
 that can also take over the central functions of anacron."

keep_empty_dirs=yes
replaces="cronie>=0"
openrc_services="crond default true"
conf_files="/var/spool/cron/root /etc/conf.d/cron"

Add_dependency run glibc

do_build()
{
	make PREFIX=/usr CRONTAB_GROUP=users CRONTABS=/var/spool/cron \
		CRONSTAMPS=/var/spool/cronstamps || return 1
}

do_install()
{
	make DESTDIR=${DESTDIR} install || return 1

	install -d ${DESTDIR}/etc/cron.{hour,week,month}ly
	install -D -m755 extra/run-cron ${DESTDIR}/usr/sbin/run-cron
	install -D -m600 extra/root.crontab ${DESTDIR}/var/spool/cron/root
	install -D -m644 extra/crond.logrotate ${DESTDIR}/etc/logrotate.d/crond

	install -D -m644 ${FILESDIR}/crond.confd ${DESTDIR}/etc/conf.d/crond
	install -D -m755 ${FILESDIR}/crond.init ${DESTDIR}/etc/init.d/crond

	# crontab must be setuid for all users to work!
	chmod 4755 ${DESTDIR}/usr/bin/crontab
}
