Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/cronie/, sys-process/cronie/files/
Date: Wed, 14 Feb 2018 16:45:08
Message-Id: 1518603669.f79f8ac5d95fa3f88301f0bad8b03e9d5f497a59.polynomial-c@gentoo
1 commit: f79f8ac5d95fa3f88301f0bad8b03e9d5f497a59
2 Author: Alexander Tsoy <alexander <AT> tsoy <DOT> me>
3 AuthorDate: Mon Feb 5 03:23:05 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 14 10:21:09 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f79f8ac5
7
8 sys-process/cronie: fix USE=anacron mess
9
10 run-crons script from sys-process/cronbase is duplicating anacron's
11 functionality. And since we run run-crons every 10 minutes and anacron
12 every hour, we end up running every daily/weekly/monthly cron job twice.
13 Fix this by removing run-crons from crontab.
14
15 Also enable USE=anacron by default because this is closer to behaviour we
16 previously had with USE=-anacron (thanks to run-crons).
17
18 Closes: https://bugs.gentoo.org/621706
19 Closes: https://github.com/gentoo/gentoo/pull/7079
20
21 sys-process/cronie/cronie-1.5.1-r1.ebuild | 101 ++++++++++++++++++++++++++++++
22 sys-process/cronie/files/cronie-crontab | 17 +++++
23 2 files changed, 118 insertions(+)
24
25 diff --git a/sys-process/cronie/cronie-1.5.1-r1.ebuild b/sys-process/cronie/cronie-1.5.1-r1.ebuild
26 new file mode 100644
27 index 00000000000..9030fc8fb1d
28 --- /dev/null
29 +++ b/sys-process/cronie/cronie-1.5.1-r1.ebuild
30 @@ -0,0 +1,101 @@
31 +# Copyright 1999-2017 Gentoo Foundation
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=6
35 +
36 +inherit autotools cron pam systemd user
37 +
38 +DESCRIPTION="Cronie is a standard UNIX daemon cron based on the original vixie-cron"
39 +HOMEPAGE="https://github.com/cronie-crond/cronie"
40 +SRC_URI="https://github.com/cronie-crond/cronie/archive/${P}.tar.gz"
41 +
42 +LICENSE="ISC BSD BSD-2 GPL-2"
43 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
44 +IUSE="+anacron +inotify pam selinux"
45 +
46 +DEPEND="pam? ( virtual/pam )
47 + anacron? ( !sys-process/anacron )"
48 +RDEPEND="${DEPEND}
49 + sys-apps/debianutils"
50 +
51 +#cronie supports /etc/crontab
52 +CRON_SYSTEM_CRONTAB="yes"
53 +
54 +S="${WORKDIR}/${PN}-${P}"
55 +
56 +PATCHES=(
57 + "${FILESDIR}/cronie-systemd.patch"
58 +)
59 +
60 +pkg_setup() {
61 + enewgroup crontab
62 +}
63 +
64 +src_prepare() {
65 + default
66 + eautoreconf
67 +}
68 +
69 +src_configure() {
70 + SPOOL_DIR="/var/spool/cron/crontabs" \
71 + ANACRON_SPOOL_DIR="/var/spool/anacron" \
72 + econf \
73 + $(use_with inotify) \
74 + $(use_with pam) \
75 + $(use_with selinux) \
76 + $(use_enable anacron) \
77 + --enable-syscrontab \
78 + --with-daemon_username=cron \
79 + --with-daemon_groupname=cron
80 +}
81 +
82 +src_install() {
83 + emake install DESTDIR="${D}"
84 +
85 + docrondir -m 1730 -o root -g crontab
86 + fowners root:crontab /usr/bin/crontab
87 + fperms 2751 /usr/bin/crontab
88 +
89 + newconfd "${S}"/crond.sysconfig ${PN}
90 +
91 + insinto /etc
92 + newins "${FILESDIR}/${PN}-crontab" crontab
93 + newins "${FILESDIR}/${PN}-1.2-cron.deny" cron.deny
94 +
95 + insinto /etc/cron.d
96 + doins contrib/0hourly
97 +
98 + newinitd "${FILESDIR}/${PN}-1.3-initd" ${PN}
99 + newpamd "${FILESDIR}/${PN}-1.4.3-pamd" crond
100 +
101 + systemd_newunit contrib/cronie.systemd cronie.service
102 +
103 + if use anacron ; then
104 + local anacrondir="/var/spool/anacron"
105 + keepdir ${anacrondir}
106 + fowners root:cron ${anacrondir}
107 + fperms 0750 ${anacrondir}
108 +
109 + insinto /etc
110 + doins contrib/anacrontab
111 +
112 + insinto /etc/cron.hourly
113 + doins contrib/0anacron
114 + fperms 0750 /etc/cron.hourly/0anacron
115 + else
116 + insinto /etc/cron.d
117 + doins contrib/dailyjobs
118 + fi
119 +
120 + einstalldocs
121 +}
122 +
123 +pkg_postinst() {
124 + cron_pkg_postinst
125 +
126 + if [[ -n "${REPLACING_VERSIONS}" ]] ; then
127 + ewarn "You should restart ${PN} daemon or else you might experience segfaults"
128 + ewarn "or ${PN} not working reliably anymore."
129 + einfo "(see https://bugs.gentoo.org/557406 for details.)"
130 + fi
131 +}
132
133 diff --git a/sys-process/cronie/files/cronie-crontab b/sys-process/cronie/files/cronie-crontab
134 new file mode 100644
135 index 00000000000..275f06c603d
136 --- /dev/null
137 +++ b/sys-process/cronie/files/cronie-crontab
138 @@ -0,0 +1,17 @@
139 +# Global variables
140 +SHELL=/bin/bash
141 +PATH=/sbin:/bin:/usr/sbin:/usr/bin
142 +MAILTO=root
143 +HOME=/
144 +
145 +# For details see man 4 crontabs
146 +
147 +# Example of job definition:
148 +# .---------------- minute (0 - 59)
149 +# | .------------- hour (0 - 23)
150 +# | | .---------- day of month (1 - 31)
151 +# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
152 +# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
153 +# | | | | |
154 +# * * * * * user-name command to be executed
155 +