From e88a8562df64bfda8c5261281a0490b7f65b4a35 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Thu, 30 Jun 2011 20:51:13 +0200 Subject: [PATCH] drop the without systemd build condition add the chkconfig readding trigger to the sysvinit subpackage --- cronie.spec | 66 +++++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 43 deletions(-) diff --git a/cronie.spec b/cronie.spec index b3f47e8..8670061 100644 --- a/cronie.spec +++ b/cronie.spec @@ -2,12 +2,11 @@ %bcond_without pam %bcond_without audit %bcond_without inotify -%bcond_without systemd Summary: Cron daemon for executing programs at set times Name: cronie Version: 1.4.8 -Release: 3%{?dist} +Release: 4%{?dist} License: MIT and BSD and ISC and GPLv2 Group: System Environment/Base URL: https://fedorahosted.org/cronie @@ -34,19 +33,10 @@ Buildrequires: audit-libs-devel >= 1.4.1 %endif Requires(post): coreutils sed -%if %{with systemd} -# systemd compatibility Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(post): systemd-sysv -%else -Requires(post): /sbin/chkconfig -Requires(postun): /sbin/chkconfig -Requires(postun): /sbin/service -Requires(preun): /sbin/chkconfig -Requires(preun): /sbin/service -%endif %description Cronie contains the standard UNIX daemon crond that runs specified programs at @@ -65,9 +55,15 @@ Requires(post): coreutils Requires: %{name} = %{version}-%{release} %description anacron -Anacron becames part of cronie. Anacron is used only for running regular jobs. -The default settings execute regular jobs by anacron, however this could be -overloaded in settings. +Anacron is part of cronie that is used for running jobs with regular +periodicity which do not have exact time of day of execution. + +The default settings of anacron execute the daily, weekly, and monthly +jobs, but anacron allows setting arbitrary periodicity of jobs. + +Using anacron allows running the periodic jobs even if the system is often +powered off and it also allows randomizing the time of the job execution +for better utilization of resources shared among multiple systems. %package noanacron Summary: Utility for running simple regular jobs in old cron style @@ -77,16 +73,18 @@ Requires: crontabs Requires: %{name} = %{version}-%{release} %description noanacron -Old style of {hourly,daily,weekly,monthly}.jobs without anacron. No features. +Old style of running {hourly,daily,weekly,monthly}.jobs without anacron. No +extra features. %package sysvinit -Summary: Sysvinit script +Summary: SysV init script for cronie Group: System Environment/Base -Requires: cronie Requires: %{name} = %{version}-%{release} +Requires(post): /sbin/chkconfig %description sysvinit -Sysvinit initscript. +SysV style init script for cronie. It needs to be installed only if systemd +is not used as the system init process. %prep %setup -q @@ -134,25 +132,19 @@ touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly # noanacron package install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs -%if %{with systemd} # install systemd initscript mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/ install -m 644 %SOURCE1 $RPM_BUILD_ROOT/lib/systemd/system/crond.service -%endif # install sysvinit initscript into sub-package mkdir -pm755 $RPM_BUILD_ROOT%{_initrddir} install -m 755 cronie.init $RPM_BUILD_ROOT%{_initrddir}/crond %post -%if %{with systemd} if [ $1 -eq 1 ] ; then # Initial installation /bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl enable crond.service >/dev/null 2>&1 || : fi -%else -/sbin/chkconfig --add crond >/dev/null 2>&1 || : -%endif %post anacron [ -e /var/spool/anacron/cron.daily ] || touch /var/spool/anacron/cron.daily @@ -161,25 +153,14 @@ fi %preun if [ $1 -eq 0 ]; then -%if %{with systemd} /bin/systemctl --no-reload disable crond.service >/dev/null 2>&1 || : /bin/systemctl stop crond.service > /dev/null 2>&1 || : -%else - service crond stop >/dev/null 2>&1 ||: - /sbin/chkconfig --del crond -%endif fi %postun -%if %{with systemd} /bin/systemctl daemon-reload >/dev/null 2>&1 || : -%endif if [ $1 -ge 1 ]; then -%if %{with systemd} /bin/systemctl try-restart crond.service >/dev/null 2>&1 || : -%else - service crond condrestart > /dev/null 2>&1 ||: -%endif fi %triggerun -- cronie < 1.4.1 @@ -191,7 +172,6 @@ sed -e '/^01 \* \* \* \* root run-parts \/etc\/cron\.hourly/d'\ -e '/^42 4 1 \* \* root run-parts \/etc\/cron\.monthly/d' /etc/crontab.rpmsave > /etc/crontab exit 0 -%if %{with systemd} %triggerun -- cronie < 1.4.7-2 # Save the current service runlevel info # User must manually run systemd-sysv-convert --apply crond @@ -204,16 +184,14 @@ exit 0 /sbin/chkconfig --del crond >/dev/null 2>&1 || : /bin/systemctl try-restart crond.service >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || : -%endif %triggerin -- pam, glibc, libselinux # changes in pam, glibc or libselinux can make crond crash # when it calls pam -%if %{with systemd} /bin/systemctl try-restart crond.service >/dev/null 2>&1 || : -%else -service crond condrestart > /dev/null 2>&1 ||: -%endif + +%triggerpostun -n cronie-sysvinit -- cronie < 1.4.8-1 +/sbin/chkconfig --add crond >/dev/null 2>&1 || : %files %doc AUTHORS COPYING INSTALL README ChangeLog @@ -231,9 +209,7 @@ service crond condrestart > /dev/null 2>&1 ||: %config(noreplace) %{_sysconfdir}/sysconfig/crond %config(noreplace) %{_sysconfdir}/cron.deny %attr(0644,root,root) %{_sysconfdir}/cron.d/0hourly -%if %{with systemd} %attr(0644,root,root) /lib/systemd/system/crond.service -%endif %files anacron %{_sbindir}/anacron @@ -253,6 +229,10 @@ service crond condrestart > /dev/null 2>&1 ||: %attr(0644,root,root) %{_initrddir}/crond %changelog +* Thu Jun 30 2011 Tomáš Mráz - 1.4.8-4 +- drop the without systemd build condition +- add the chkconfig readding trigger to the sysvinit subpackage + * Wed Jun 29 2011 Tomáš Mráz - 1.4.8-3 - start crond after auditd