# Template file for 'dcron'
pkgname=dcron
version=4.6
revision=1
build_style="gnu-makefile"
make_use_env="yes"
make_build_args="CRONTAB_GROUP=root CRONTABS=/var/spool/cron CRONSTAMPS=/var/spool/cronstamps"
make_install_args="SBINDIR=/usr/bin"
short_desc="Dillon's lightweight cron daemon"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://github.com/ptchinster/dcron"
changelog="https://raw.githubusercontent.com/ptchinster/dcron/refs/heads/master/CHANGELOG.md"
distfiles="https://github.com/ptchinster/dcron/archive/refs/tags/v${version}.tar.gz"
checksum=d1dced1554213225f5ca333ebc5eab96ab80fa30800d9420782d5dfa6e2a15e7
conf_files="/var/spool/cron/root"
provides="cron-daemon-0_1"

alternatives="
 crond:crond:/etc/sv/dcron
 crond:crond:/usr/bin/dcrond
 crond:crontab:/usr/bin/dcrontab
 crond:crontab.1:/usr/share/man/man1/dcrontab.1
 crond:crond.8:/usr/share/man/man8/dcrond.8
"

make_dirs="
 /etc/cron.d 0755 root root
 /etc/cron.hourly 0755 root root
 /etc/cron.daily 0755 root root
 /etc/cron.weekly 0755 root root
 /etc/cron.monthly 0755 root root
 /var/spool/cronstamps 0755 root root"

post_install() {
	vbin extra/run-cron
	vinstall extra/root.crontab 644 /var/spool/cron root

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

	vsv dcron cron

	# Fix conflicts with other packages
	mv ${DESTDIR}/usr/bin/crond ${DESTDIR}/usr/bin/dcrond
	mv ${DESTDIR}/usr/bin/crontab ${DESTDIR}/usr/bin/dcrontab
	mv ${DESTDIR}/usr/share/man/man1/crontab.1 ${DESTDIR}/usr/share/man/man1/dcrontab.1
	mv ${DESTDIR}/usr/share/man/man8/crond.8 ${DESTDIR}/usr/share/man/man8/dcrond.8
}
