Skip to content

Commit

Permalink
sys-process/cronie: USE=anacron needs obstack
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.40, Repoman-2.3.9
  • Loading branch information
blueness committed Jun 23, 2018
1 parent d430647 commit 1e32d2f
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys-process/cronie/Manifest
@@ -0,0 +1 @@
DIST cronie-1.5.2.tar.gz 121604 BLAKE2B 4225439fd13a32bba3bd24f25d7dd405cdb123e666ebbf14574143af9d161867f82ea3fc479d81a884590faaa9c42e19c971285e01a19d6ac793b7deb7fc4775 SHA512 6455e234becc44e6568fa25fd72abfaa293cb0bc2d2f1d124e551c068ba01083192b21e82e941158c8c1f41cb6dad3851d665b9f3baa82fd49080f3f8619740b
107 changes: 107 additions & 0 deletions sys-process/cronie/cronie-1.5.2.ebuild
@@ -0,0 +1,107 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit autotools cron flag-o-matic pam systemd user

DESCRIPTION="Cronie is a standard UNIX daemon cron based on the original vixie-cron"
HOMEPAGE="https://github.com/cronie-crond/cronie"
SRC_URI="https://github.com/cronie-crond/cronie/archive/${P}.tar.gz"

LICENSE="ISC BSD BSD-2 GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
IUSE="+anacron +inotify pam selinux"

DEPEND="pam? ( virtual/pam )
anacron? ( !sys-process/anacron
elibc_musl? ( sys-libs/obstack-standalone )
)"
RDEPEND="${DEPEND}
sys-apps/debianutils"

#cronie supports /etc/crontab
CRON_SYSTEM_CRONTAB="yes"

S="${WORKDIR}/${PN}-${P}"

PATCHES=(
"${FILESDIR}/cronie-systemd.patch"
)

pkg_setup() {
enewgroup crontab
}

src_prepare() {
default
eautoreconf
}

src_configure() {
local myeconfargs=(
$(use_with inotify)
$(use_with pam)
$(use_with selinux)
$(use_enable anacron)
--enable-syscrontab
--with-daemon_username=cron
--with-daemon_groupname=cron
)

use elibc_musl && append-ldflags "-lobstack"
SPOOL_DIR="/var/spool/cron/crontabs" \
ANACRON_SPOOL_DIR="/var/spool/anacron" \
econf "${myeconfargs[@]}"
}

src_install() {
emake install DESTDIR="${D}"

docrondir -m 1730 -o root -g crontab
fowners root:crontab /usr/bin/crontab
fperms 2751 /usr/bin/crontab

newconfd "${S}"/crond.sysconfig ${PN}

insinto /etc
newins "${FILESDIR}/${PN}-crontab" crontab
newins "${FILESDIR}/${PN}-1.2-cron.deny" cron.deny

insinto /etc/cron.d
doins contrib/0hourly

newinitd "${FILESDIR}/${PN}-1.3-initd" ${PN}
newpamd "${FILESDIR}/${PN}-1.4.3-pamd" crond

systemd_newunit contrib/cronie.systemd cronie.service

if use anacron ; then
local anacrondir="/var/spool/anacron"
keepdir ${anacrondir}
fowners root:cron ${anacrondir}
fperms 0750 ${anacrondir}

insinto /etc
doins contrib/anacrontab

insinto /etc/cron.hourly
doins contrib/0anacron
fperms 0750 /etc/cron.hourly/0anacron
else
insinto /etc/cron.d
doins contrib/dailyjobs
fi

einstalldocs
}

pkg_postinst() {
cron_pkg_postinst

if [[ -n "${REPLACING_VERSIONS}" ]] ; then
ewarn "You should restart ${PN} daemon or else you might experience segfaults"
ewarn "or ${PN} not working reliably anymore."
einfo "(see https://bugs.gentoo.org/557406 for details.)"
fi
}
4 changes: 4 additions & 0 deletions sys-process/cronie/files/cronie-1.2-cron.deny
@@ -0,0 +1,4 @@
# If for any reason you have users in the 'cron' group who should not
# be allowed to run crontab, add them to this file (one username per
# line)

13 changes: 13 additions & 0 deletions sys-process/cronie/files/cronie-1.3-initd
@@ -0,0 +1,13 @@
#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

command="/usr/sbin/crond"
command_args="${CRONDARGS}"
pidfile="/var/run/crond.pid"

depend() {
use clock logger
need localmount
provide cron
}
9 changes: 9 additions & 0 deletions sys-process/cronie/files/cronie-1.4.3-pamd
@@ -0,0 +1,9 @@
#
# The PAM configuration file for the cron daemon
#
#
auth include system-auth
account required pam_access.so
account include system-auth
session required pam_loginuid.so
session include system-auth
17 changes: 17 additions & 0 deletions sys-process/cronie/files/cronie-crontab
@@ -0,0 +1,17 @@
# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

30 changes: 30 additions & 0 deletions sys-process/cronie/files/cronie-systemd.patch
@@ -0,0 +1,30 @@
From 11d255eb05ae9814c16cd443a7710d99492e16c1 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 13 Jul 2015 10:59:57 -0400
Subject: [PATCH] Adjust systemd service unit for Gentoo

---
contrib/cronie.systemd | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/contrib/cronie.systemd b/contrib/cronie.systemd
index ad46899..7a6c1a9 100644
--- a/contrib/cronie.systemd
+++ b/contrib/cronie.systemd
@@ -3,10 +3,11 @@ Description=Command Scheduler
After=auditd.service nss-user-lookup.target systemd-user-sessions.service time-sync.target ypbind.service

[Service]
-EnvironmentFile=/etc/sysconfig/crond
-ExecStart=/usr/sbin/crond -n $CRONDARGS
+ExecStart=/usr/sbin/crond
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
+Type=forking
+PIDFile=/var/run/crond.pid

[Install]
WantedBy=multi-user.target
--
2.4.5

26 changes: 26 additions & 0 deletions sys-process/cronie/metadata.xml
@@ -0,0 +1,26 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>polynomial-c@gentoo.org</email>
<name>Lars Wendler</name>
</maintainer>
<maintainer type="project">
<email>cron-bugs@gentoo.org</email>
<name>Gentoo Cron Project</name>
</maintainer>
<longdescription lang="en">
Cronie contains the standard UNIX daemon crond that runs specified programs at
scheduled times and related tools. It is based on the original cron and
has security and configuration enhancements like the ability to use pam and
SELinux.
And why cronie? See http://www.urbandictionary.com/define.php?term=cronie
</longdescription>
<use>
<flag name="anacron">Install the periodic anacron command scheduler.</flag>
<flag name="inotify">Enable inotify filesystem monitoring support.</flag>
</use>
<upstream>
<remote-id type="github">cronie-crond/cronie</remote-id>
</upstream>
</pkgmetadata>

0 comments on commit 1e32d2f

Please sign in to comment.