sys-process/systemd-cron: revbump

Allow to disable system scheduling and only keep user crontabs handling
Fix root units and postfix permissions in case of failure

Package-Manager: Portage-3.0.17, Repoman-3.0.2
This commit is contained in:
Guillaume Castagnino 2021-03-14 11:50:28 +01:00
parent f341adab1e
commit 60114a8acd
5 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,5 @@
AUX systemd-cron-always-set-user.patch 548 BLAKE2B 68b882f12c8be3d9ea4b8b669f869f380c41303e70934af850c419d39480ec252ea7ed596c9238d44d4333ce23fb775cad2d0e19aff242efcaaf9426811edd78 SHA512 faf092fe7664ab815dc48e5b091ab59d5ecc8984db799bcd2f95f55ab029bb4454dbcfea9e8d9055b8b88424d540e1dfedd450dccf9f88e221371031cdec8441
AUX systemd-cron-make-postdrop-readwrite.patch 317 BLAKE2B 7801c5cac66e59b2b197b476d4173385c5df48cafd5a519930b7c84b3926b590ef6fc51fba3d866778b0d3103c961fe03e6b93d396ce6d4eb6ff5e20bc4eae17 SHA512 e99cdfab59dcdf0c09217744421d013d80a69ac02d58002b829aafa34e9a814c19c948e09fe6a23d08ff038f54592905282d684926150ea71726cf480f42655f
DIST systemd-cron-1.5.17.tar.gz 32319 BLAKE2B 763cccebcaf98998d0e787352b4d3f2bc28a7e6ef0e800fe937fb2971a5dd8af2d9880076eadb5c3eddc23957d9b6b824b87a7a8be59c241f402ad78abed248e SHA512 20f93c108689efef5a72976509ffd567ed85dd1fada5074030018b5d560cc49f60337bdf888d1d75f6ce8b9b72e6314d754c78c19fa79d584740430e44240ef3
EBUILD systemd-cron-1.5.17-r1.ebuild 2773 BLAKE2B d52efdc67faed6ac573d9ffd99832ca1e93d784c5c6ba7d54f6dad6a351113c38824bcc9a1be1d5c71a07c62b845589b279bf77368588e5c72346fc05641802c SHA512 e62d3ff37a1f3151cd313a792a261a4e69a779b801ebeacd40fb63cfc9f834b44065c3cf8b245f429822a9515f3d61766093ea644627b29db443bea8873c8244
MISC metadata.xml 891 BLAKE2B 8b071f52efde051baa522136ea3108825ecdd5d80e600c5744d6889f6ce18f22d4bec910164f445b3657955b52ab5873f707220943dffcc6d128f26a92cac07c SHA512 7ea066e178b1cb0b1f1f6f64c29f0ec0906e75f66285db846807e114bfcb6d838d354b400920022a38cdb7487c7a68e3d6bc574ae85413a0ed46641112dae30b

View File

@ -0,0 +1,12 @@
--- ./src/bin/systemd-crontab-generator.py.old 2021-03-07 10:34:43.362030743 +0100
+++ ./src/bin/systemd-crontab-generator.py 2021-03-07 10:35:06.289909296 +0100
@@ -475,8 +475,7 @@
f.write('ExecStart=%s\n' % command)
if job['e']:
f.write('Environment=%s\n' % job['e'])
- if job['u'] != 'root':
- f.write('User=%s\n' % job['u'])
+ f.write('User=%s\n' % job['u'])
if standardoutput:
f.write('StandardOutput=%s\n' % standardoutput)
if 'Z' in job and job['Z']:

View File

@ -0,0 +1,8 @@
--- ./src/units/cron-failure@.service.in.old 2021-03-09 14:16:12.331152156 +0100
+++ ./src/units/cron-failure@.service.in 2021-03-09 14:17:46.801659607 +0100
@@ -10,3 +10,5 @@
ExecStart=@libdir@/@package@/mail_on_failure %i
DynamicUser=yes
Group=systemd-journal
+ReadWriteDirectories=/var/spool/postfix/maildrop
+

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>rich0@gentoo.org</email>
</maintainer>
<use>
<flag name="cron-boot">Include support for the boot timer.</flag>
<flag name="etc-crontab-systemd">Use dedicated /etc/crontab-systemd instead of parsing /etc/crontab</flag>
<flag name="minutely">Support /etc/cron.minutely</flag>
<flag name="runparts">Use traditional run-parts instead of creating jobs for each cron.* entry</flag>
<flag name="system-timers">Support standard system timers directories /etc/cron.*</flag>
<flag name="yearly">Support /etc/cron.yearly</flag>
<flag name="setgid">Compile setgid C helper for crontab. Needs GCC or Clang.</flag>
</use>
<upstream>
<remote-id type="github">systemd-cron/systemd-cron</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,100 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( pypy3 python3_{7,8,9} )
inherit python-single-r1 systemd
DESCRIPTION="systemd units to create timers for cron directories and crontab"
HOMEPAGE="https://github.com/systemd-cron/systemd-cron/"
SRC_URI="https://github.com/systemd-cron/${PN}/archive/v${PV}.tar.gz -> systemd-cron-${PV}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="cron-boot etc-crontab-systemd minutely +runparts setgid system-timers test yearly"
RESTRICT="!test? ( test )"
REQUIRED_USE="!system-timers? (
&& (
!minutely
!yearly
)
)"
RDEPEND=">=sys-apps/systemd-217
sys-apps/debianutils
!sys-process/cronie[anacron]
!etc-crontab-systemd? ( !sys-process/dcron )
${PYTHON_DEPS}
sys-process/cronbase"
DEPEND="sys-process/cronbase
test? ( sys-apps/man-db dev-python/pyflakes )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
PATCHES=(
"${FILESDIR}/${PN}-always-set-user.patch"
"${FILESDIR}/${PN}-make-postdrop-readwrite.patch"
)
src_prepare() {
default
python_fix_shebang --force "${S}/src/bin"
sed -i \
-e 's/^crontab/crontab-systemd/' \
-e 's/^CRONTAB/CRONTAB-SYSTEMD/' \
-- "${S}/src/man/crontab."{1,5}".in" || die
sed -i \
-e 's!/crontab$!/crontab-systemd!' \
-e 's!/crontab\(\.[15]\)$!/crontab-systemd\1!' \
-e 's/pyflakes3/pyflakes/' \
-- "${S}/Makefile.in" || die
if use etc-crontab-systemd
then sed -i \
-e "s!/etc/crontab!/etc/crontab-systemd!" \
-- "${S}/src/man/crontab."{1,5}".in" \
"${S}/src/bin/systemd-crontab-generator.py" || die
fi
}
my_use_enable() {
if use ${1}; then
echo --enable-${2:-${1}}=yes
else
echo --enable-${2:-${1}}=no
fi
}
src_configure() {
./configure \
--prefix="${EPREFIX}/usr" \
--confdir="${EPREFIX}/etc" \
--runparts="${EPREFIX}/bin/run-parts" \
--mandir="${EPREFIX}/usr/share/man" \
--unitdir="$(systemd_get_systemunitdir)" \
--generatordir="$(systemd_get_systemgeneratordir)" \
$(my_use_enable cron-boot boot) \
$(my_use_enable minutely) \
$(my_use_enable runparts) \
$(my_use_enable system-timers hourly) \
$(my_use_enable system-timers daily) \
$(my_use_enable system-timers weekly) \
$(my_use_enable system-timers monthly) \
$(my_use_enable yearly) \
$(my_use_enable yearly quarterly) \
$(my_use_enable yearly semi_annually) \
$(my_use_enable setgid) \
--enable-persistent=yes
}
pkg_postinst() {
elog "This package now supports USE=runparts which is enabled by default."
elog "This enables the traditional run-parts behavior."
elog "If you disable this flag you will get the new behavior of having"
elog "multiple jobs for each cron.* entry run in parallel with"
elog "separate services/logs/etc."
}