summaryrefslogtreecommitdiff
blob: 93064a15df6409f107b4573643a1b392e9a9fc99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{9..11} )

inherit cron python-any-r1 toolchain-funcs

DESCRIPTION="A new cron system designed with secure operations in mind by Bruce Guenter"
HOMEPAGE="https://untroubled.org/bcron/"
SRC_URI="https://untroubled.org/bcron/archive/${P}.tar.gz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="amd64 ~loong ~riscv x86"

RDEPEND=">=dev-libs/bglibs-2.04
	sys-apps/ucspi-unix
	sys-process/cronbase
	virtual/daemontools
	virtual/mta"
DEPEND="${RDEPEND}
	${PYTHON_DEPS}"

CRON_SYSTEM_CRONTAB="yes"

PATCHES=( "${FILESDIR}/${PN}-0.09-fix-socket-permissions.patch" )

src_configure() {
	echo "${ED}/usr/bin" > conf-bin || die
	echo "$(tc-getCC) ${CFLAGS}" > conf-cc || die
	echo "$(tc-getCC) ${CFLAGS} ${LDFLAGS} -L${EPREFIX}/usr/$(get_libdir)/bglibs" > conf-ld || die
	echo "${ED}/usr/share/man" > conf-man || die
}

src_install() {
	default

	docrontab bcrontab
	docrondir -o cron -g cron
	docrondir /var/spool/cron/tmp -o cron -g cron

	keepdir /etc/cron.d
	dodir /etc/bcron
	insinto /etc
	doins "${FILESDIR}"/crontab

	insinto /var/lib/supervise/bcron
	doins bcron-sched.run

	insinto /var/lib/supervise/bcron/log
	doins bcron-sched-log.run

	insinto /var/lib/supervise/bcron-spool
	doins bcron-spool.run

	insinto /var/lib/supervise/bcron-update
	doins bcron-update.run

	doman bcrontab.1 crontab.5 bcron-update.8 bcron-start.8
	doman bcron-spool.8 bcron-sched.8 bcron-exec.8
	dodoc ANNOUNCEMENT NEWS README TODO
}

pkg_config() {
	cd "${EROOT}"/var/lib/supervise/bcron || die
	if [[ -e run ]] ; then
		cp run bcron-sched.run.`date +%Y%m%d%H%M%S` || die
	fi
	cp bcron-sched.run run || die
	chmod u+x run || die

	cd "${EROOT}"/var/lib/supervise/bcron/log || die
	if [[ -e run ]] ; then
		cp run bcron-sched-log.run.`date +%Y%m%d%H%M%S` || die
	fi
	cp bcron-sched-log.run run || die
	chmod u+x run || die

	cd "${EROOT}"/var/lib/supervise/bcron-spool || die
	if [[ -e run ]] ; then
		 cp run bcron-spool.run.`date +%Y%m%d%H%M%S` || die
	fi
	cp bcron-spool.run run || die
	chmod u+x run || die

	cd "${EROOT}"/var/lib/supervise/bcron-update || die
	if [[ -e run ]] ; then
		cp run bcron-update.run.`date +%Y%m%d%H%M%S` || die
	fi
	cp bcron-update.run run || die
	chmod u+x run || die

	if [[ ! -e "${EROOT}"/var/spool/cron/trigger ]] ; then
		mkfifo "${EROOT}"/var/spool/cron/trigger || die
	fi
	chown cron:cron "${EROOT}"/var/spool/cron/trigger || die
	chmod go-rwx "${EROOT}"/var/spool/cron/trigger || die
}

pkg_postinst() {
	elog "Run "
	elog "emerge --config '=${CATEGORY}/${PF}'"
	elog "to create or update your run files (backups are created) in"
	elog "		/var/lib/supervise/bcron (bcron daemon) and"
	elog "		/var/lib/supervise/bcron-spool (crontab receiver) and"
	elog "		/var/lib/supervise/bcron-update (system crontab updater)"

	cron_pkg_postinst
}