drop the without systemd build condition

add the chkconfig readding trigger to the sysvinit subpackage
This commit is contained in:
Tomas Mraz 2011-06-30 20:51:13 +02:00
parent 848a0220c2
commit e88a8562df
1 changed files with 23 additions and 43 deletions

View File

@ -2,12 +2,11 @@
%bcond_without pam %bcond_without pam
%bcond_without audit %bcond_without audit
%bcond_without inotify %bcond_without inotify
%bcond_without systemd
Summary: Cron daemon for executing programs at set times Summary: Cron daemon for executing programs at set times
Name: cronie Name: cronie
Version: 1.4.8 Version: 1.4.8
Release: 3%{?dist} Release: 4%{?dist}
License: MIT and BSD and ISC and GPLv2 License: MIT and BSD and ISC and GPLv2
Group: System Environment/Base Group: System Environment/Base
URL: https://fedorahosted.org/cronie URL: https://fedorahosted.org/cronie
@ -34,19 +33,10 @@ Buildrequires: audit-libs-devel >= 1.4.1
%endif %endif
Requires(post): coreutils sed Requires(post): coreutils sed
%if %{with systemd}
# systemd compatibility
Requires(post): systemd-units Requires(post): systemd-units
Requires(preun): systemd-units Requires(preun): systemd-units
Requires(postun): systemd-units Requires(postun): systemd-units
Requires(post): systemd-sysv 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 %description
Cronie contains the standard UNIX daemon crond that runs specified programs at Cronie contains the standard UNIX daemon crond that runs specified programs at
@ -65,9 +55,15 @@ Requires(post): coreutils
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%description anacron %description anacron
Anacron becames part of cronie. Anacron is used only for running regular jobs. Anacron is part of cronie that is used for running jobs with regular
The default settings execute regular jobs by anacron, however this could be periodicity which do not have exact time of day of execution.
overloaded in settings.
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 %package noanacron
Summary: Utility for running simple regular jobs in old cron style Summary: Utility for running simple regular jobs in old cron style
@ -77,16 +73,18 @@ Requires: crontabs
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%description noanacron %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 %package sysvinit
Summary: Sysvinit script Summary: SysV init script for cronie
Group: System Environment/Base Group: System Environment/Base
Requires: cronie
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires(post): /sbin/chkconfig
%description sysvinit %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 %prep
%setup -q %setup -q
@ -134,25 +132,19 @@ touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly
# noanacron package # noanacron package
install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs
%if %{with systemd}
# install systemd initscript # install systemd initscript
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/ mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/
install -m 644 %SOURCE1 $RPM_BUILD_ROOT/lib/systemd/system/crond.service install -m 644 %SOURCE1 $RPM_BUILD_ROOT/lib/systemd/system/crond.service
%endif
# install sysvinit initscript into sub-package # install sysvinit initscript into sub-package
mkdir -pm755 $RPM_BUILD_ROOT%{_initrddir} mkdir -pm755 $RPM_BUILD_ROOT%{_initrddir}
install -m 755 cronie.init $RPM_BUILD_ROOT%{_initrddir}/crond install -m 755 cronie.init $RPM_BUILD_ROOT%{_initrddir}/crond
%post %post
%if %{with systemd}
if [ $1 -eq 1 ] ; then if [ $1 -eq 1 ] ; then
# Initial installation # Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
/bin/systemctl enable crond.service >/dev/null 2>&1 || : /bin/systemctl enable crond.service >/dev/null 2>&1 || :
fi fi
%else
/sbin/chkconfig --add crond >/dev/null 2>&1 || :
%endif
%post anacron %post anacron
[ -e /var/spool/anacron/cron.daily ] || touch /var/spool/anacron/cron.daily [ -e /var/spool/anacron/cron.daily ] || touch /var/spool/anacron/cron.daily
@ -161,25 +153,14 @@ fi
%preun %preun
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
%if %{with systemd}
/bin/systemctl --no-reload disable crond.service >/dev/null 2>&1 || : /bin/systemctl --no-reload disable crond.service >/dev/null 2>&1 || :
/bin/systemctl stop 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 fi
%postun %postun
%if %{with systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
%endif
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
%if %{with systemd}
/bin/systemctl try-restart crond.service >/dev/null 2>&1 || : /bin/systemctl try-restart crond.service >/dev/null 2>&1 || :
%else
service crond condrestart > /dev/null 2>&1 ||:
%endif
fi fi
%triggerun -- cronie < 1.4.1 %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 -e '/^42 4 1 \* \* root run-parts \/etc\/cron\.monthly/d' /etc/crontab.rpmsave > /etc/crontab
exit 0 exit 0
%if %{with systemd}
%triggerun -- cronie < 1.4.7-2 %triggerun -- cronie < 1.4.7-2
# Save the current service runlevel info # Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply crond # User must manually run systemd-sysv-convert --apply crond
@ -204,16 +184,14 @@ exit 0
/sbin/chkconfig --del crond >/dev/null 2>&1 || : /sbin/chkconfig --del crond >/dev/null 2>&1 || :
/bin/systemctl try-restart crond.service >/dev/null 2>&1 || : /bin/systemctl try-restart crond.service >/dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
%endif
%triggerin -- pam, glibc, libselinux %triggerin -- pam, glibc, libselinux
# changes in pam, glibc or libselinux can make crond crash # changes in pam, glibc or libselinux can make crond crash
# when it calls pam # when it calls pam
%if %{with systemd}
/bin/systemctl try-restart crond.service >/dev/null 2>&1 || : /bin/systemctl try-restart crond.service >/dev/null 2>&1 || :
%else
service crond condrestart > /dev/null 2>&1 ||: %triggerpostun -n cronie-sysvinit -- cronie < 1.4.8-1
%endif /sbin/chkconfig --add crond >/dev/null 2>&1 || :
%files %files
%doc AUTHORS COPYING INSTALL README ChangeLog %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}/sysconfig/crond
%config(noreplace) %{_sysconfdir}/cron.deny %config(noreplace) %{_sysconfdir}/cron.deny
%attr(0644,root,root) %{_sysconfdir}/cron.d/0hourly %attr(0644,root,root) %{_sysconfdir}/cron.d/0hourly
%if %{with systemd}
%attr(0644,root,root) /lib/systemd/system/crond.service %attr(0644,root,root) /lib/systemd/system/crond.service
%endif
%files anacron %files anacron
%{_sbindir}/anacron %{_sbindir}/anacron
@ -253,6 +229,10 @@ service crond condrestart > /dev/null 2>&1 ||:
%attr(0644,root,root) %{_initrddir}/crond %attr(0644,root,root) %{_initrddir}/crond
%changelog %changelog
* Thu Jun 30 2011 Tomáš Mráz <tmraz@redhat.com> - 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 <tmraz@redhat.com> - 1.4.8-3 * Wed Jun 29 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-3
- start crond after auditd - start crond after auditd