# https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd # https://github.com/systemd/systemd/blob/42911a567dc22c3115fb3ee3c56a7dcfb034f102/src/core/macros.systemd.in # "If your package includes one or more systemd units that need # to be enabled by default on package installation, # they must be covered by the Fedora preset policy." Name: systemd-cron Version: 2.5.1 Release: %{autorelease} License: MIT Summary: systemd generator to provide cron daemon & anacron functionality Url: https://github.com/systemd-cron/systemd-cron/ Source0: https://github.com/systemd-cron/systemd-cron/archive/v%{version}.tar.gz Provides: cronie Provides: cronie-anacron Conflicts: cronie Conflicts: cronie-anacron Requires: crontabs Requires: systemd BuildRequires: g++ BuildRequires: libmd-devel %description Provides a systemd generator to run cron jobs in /etc/cron.hourly cron.daily cron.weekly and cron.monthly directories, crontab etc.. without having cron or anacron installed. %pre touch /run/crond.reboot touch /run/crond.bootdir # /etc/cron.boot isn't on fedora, # but we're enabling support for it anyways. %preun %systemd_preun cron.target %post # XXX this macro doesn't seems to do anything %systemd_post cron.target if [ $1 -eq 1 ] ; then systemctl daemon-reload systemctl enable cron.target systemctl start cron.target fi %postun %systemd_postun_with_restart cron.target %prep %setup -q %build ./configure \ --enable-runparts=no \ --enable-minutely=yes \ --enable-quarterly=yes \ --enable-semi_annually=yes \ --enable-boot=no # Disabled run-parts i.e. static single units for each granuarity level. # Instead opting to use only systemd-generators # run-parts override the generator when installed # Also enabled all disabled granularity levels # cron.boot isn't supported in fedora, # But we enable it anyway for those who want it. # Compile %make_build %install make DESTDIR=$RPM_BUILD_ROOT install mkdir -p $RPM_BUILD_ROOT/var/spool/cron mkdir -p $RPM_BUILD_ROOT/etc/cron.d/ mkdir -p $RPM_BUILD_ROOT/etc/cron.weekly/ # Cleanup cronjob not included as systemd timer for it exists. # cp contrib/systemd-cron.cron.weekly $RPM_BUILD_ROOT/etc/cron.weekly/systemd-cron mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system-preset/ echo 'enable cron.target' > $RPM_BUILD_ROOT/usr/lib/systemd/system-preset/50-systemd-cron.preset # Licensing cp LICENSE COPYING %files %license LICENSE %doc README.md CHANGELOG COPYING %dir /etc/cron.d/ %dir /etc/cron.weekly/ %dir /var/spool/cron %dir /usr/libexec/systemd-cron /usr/lib/sysusers.d/systemd-cron.conf /usr/bin/crontab /usr/libexec/systemd-cron/mail_for_job /usr/libexec/systemd-cron/boot_delay /usr/libexec/systemd-cron/remove_stale_stamps /usr/libexec/systemd-cron/crontab_setgid /usr/lib/systemd/system-generators/systemd-crontab-generator /usr/lib/systemd/system-preset/50-systemd-cron.preset /usr/lib/systemd/system/cron.target /usr/lib/systemd/system/cron-update.path /usr/lib/systemd/system/cron-update.service /usr/lib/systemd/system/cron-mail@.service /usr/lib/systemd/system/systemd-cron-cleaner.service /usr/lib/systemd/system/systemd-cron-cleaner.timer %{_mandir}/man1/crontab.* %{_mandir}/man5/crontab.* %{_mandir}/man5/anacrontab.* %{_mandir}/man7/systemd.cron.* %{_mandir}/man8/systemd-crontab-generator.*