SHA256
1
0
forked from pool/cronie
cronie/cronie.spec

230 lines
8.0 KiB
RPMSpec

#
# spec file for package cronie (Version 1.4.6)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
# 3 : we don't need to do something with /etc/sysconfig/cron for now
%define cron_configs \{/etc/init.d/cron,/etc/pam.d/crond,/etc/crontab,/etc/cron.deny,/etc/omc/srvinfo.d/cron.xml\}
Name: cronie
BuildRequires: audit-devel libselinux-devel pam-devel xz udev syslogd
Url: https://fedorahosted.org/cronie/
License: MIT and BSD and GPLv2
Group: System/Daemons
Recommends: smtp_daemon
Recommends: postfix
AutoReqProv: on
PreReq: permissions %fillup_prereq %insserv_prereq cron
Version: 1.4.6
Release: 4
%{expand: %%define cronie_version %version}
Summary: Cron Daemon
Source0: %name-%version.tar.xz
Source1: cron.init
Source2: run-crons
Source3: sample.root
Source4: deny.sample
Source5: cron.xml
Source6: cronie-rpmlintrc
Source7: cron_to_cronie.README
Source8: cron.service
# PATCH-FEATURE-OPENSUSE cronie-pam_config.diff added pam config file from old cron
Patch3: %name-pam_config.diff
# openSUSE set NHEADER_LINES to 3 - old openSUSE cron put three lines of comments
# in top of crontab file, so we want to hide this junk comments if user edit
# crontab file with crontab -e command, patch grabbed from old openSUSE cron
Patch4: %name-nheader_lines.diff
# we use cron.pid instead of crond.pid
Patch5: %name-crond_pid.diff
Conflicts: cron <= 4.1
# When finish update protection of sles11 we could uncomment line bellow and drop all
# ugly hacks with subpackage cron needed for proper update proces
# Obsoletes: cron <=4.x
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
cron automatically starts programs at specific times. Add new entries
with "crontab -e". (See "man 5 crontab" and "man 1 crontab" for
documentation.)
Under /etc, find the directories cron.hourly, cron.daily, cron.weekly,
and cron.monthly. Scripts and programs that are located there are
started automatically.
%package -n cron
License: MIT and BSD and GPLv2
Version: 4.2
Release: 6
Summary: Auxiliary package
Group: System/Daemons
Requires: %{name} = %{cronie_version}-%{release}
%description -n cron
Auxiliary package, needed for proper update from vixie-cron 4.1 to cronie 1.4.4
%package anacron
License: MIT and BSD and GPLv2
Summary: Utility for running regular jobs
Group: System/Base
Requires: %{name} = %{cronie_version}
%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.
%prep
%setup -q
%patch3 -p1
%patch4
%patch5 -p1
cp %{S:7} ./cron_to_cronie.README
%build
autoreconf -fiv
# fill macro CRON_VERSION it is used in top three lines of crontab file,should be reworked
export CFLAGS="$RPM_OPT_FLAGS -DCRON_VERSION=\\\"%{version}\\\""
export LDFLAGS="-Wl,-z,relro,-z,now,-z,defs"
%configure --with-audit --enable-anacron --with-pam --with-selinux --with-inotify --enable-pie SPOOL_DIR="/var/spool/cron/tabs"
%{__make} %{?_smp_mflags}
%install
%makeinstall
%{__mkdir_p} -v %{buildroot}%{_localstatedir}/spool/cron/{tabs,lastrun}
%{__mkdir_p} -v %{buildroot}%{_sysconfdir}/cron.{d,hourly,daily,weekly,monthly}
%{__install} -v -m 600 %{SOURCE3} %{buildroot}/etc/crontab
%{__install} -v -m 600 %{SOURCE4} %{buildroot}/etc/cron.deny
%{__install} -v -d %{buildroot}/usr/lib/cron
%{__install} -v %{SOURCE2} %{buildroot}/usr/lib/cron
%{__install} -v -d %{buildroot}%{_sysconfdir}/init.d/
%{__install} -v -m744 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/cron
%{__ln_s} -f ../../etc/init.d/cron %{buildroot}/usr/sbin/rccron
%{__install} -v -d %{buildroot}/lib/systemd/system
%{__install} -v -m 644 %{SOURCE8} %{buildroot}/lib/systemd/system
%{__install} -m 644 contrib/anacrontab $RPM_BUILD_ROOT%{_sysconfdir}/anacrontab
%{__install} -c -m755 contrib/0anacron $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/0anacron
%{__mkdir_p} $RPM_BUILD_ROOT/var/spool/anacron
%{__mv} %{buildroot}%{_sbindir}/crond %{buildroot}%{_sbindir}/cron
touch $RPM_BUILD_ROOT/var/spool/anacron/cron.daily
touch $RPM_BUILD_ROOT/var/spool/anacron/cron.weekly
touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly
# service xml
%{__install} -v -d %{buildroot}%{_sysconfdir}/omc/srvinfo.d/
%{__install} -v -m644 %{S:5} %{buildroot}%{_sysconfdir}/omc/srvinfo.d/
%pre -n cron
# check if we are doing "ugly" update from old 4.1 vixie-cron
check_cron_mail_feature=`/usr/sbin/cron --help 2>&1 | /usr/bin/grep mail`
# vixie-cron 4.1 doesn't contain mail fature
if [ -e /usr/sbin/cron -a "${check_cron_mail_feature}" == "" ]; then
# save configs for cronie post-install phase
touch /var/run/update_from_old_cron
echo $1
for conf in %{cron_configs}
do
%__mv "$conf" "$conf.bk" ||:
done
fi
%pre
if [ -e /var/run/update_from_old_cron ]; then
# restore configs
for conf in %{cron_configs}
do
%__mv "$conf.bk" "$conf" ||:
done
fi
%post
# when we are doing rename then we pretend update with set 2
if [ -e /var/run/update_from_old_cron ]; then
set 2
%restart_on_update cron
# in %postun restart_on_update call try-restart but we don't have init script in this phase when
# we are doing "ugly" update, but don't panic, it produces only warning to stderr
echo "Please ignore message about missing init script(from postun) - when occurs, we will install init script later with cronie package"
%__mv /etc/init.d/cron /etc/init.d/cron.bk ||:
%__ln_s /bin/true /etc/init.d/cron
fi
%{fillup_and_insserv -y cron}
%run_permissions
%verifyscript
%verify_permissions -e /etc/crontab -e /usr/bin/crontab
%preun
%stop_on_removal cron
%postun
%restart_on_update cron
%insserv_cleanup
%posttrans
if [ -e /var/run/update_from_old_cron ]; then
%{__rm} /var/run/update_from_old_cron ||:
%__mv /etc/init.d/cron.bk /etc/init.d/cron ||:
fi
%post anacron
[ -e /var/spool/anacron/cron.daily ] || touch /var/spool/anacron/cron.daily
[ -e /var/spool/anacron/cron.weekly ] || touch /var/spool/anacron/cron.weekly
[ -e /var/spool/anacron/cron.monthly ] || touch /var/spool/anacron/cron.monthly
%files
%defattr(-,root,root)
%doc AUTHORS COPYING INSTALL README ChangeLog
%dir %attr(700,root,root) /var/spool/cron
%dir %attr(700,root,root) /var/spool/cron/tabs
%dir /var/spool/cron/lastrun
%config /etc/init.d/cron
%config /etc/pam.d/crond
%verify(not mode) %config(noreplace) /etc/crontab
%config(noreplace) /etc/cron.deny
%{_mandir}/man1/crontab.1.gz
%{_mandir}/man5/crontab.5.gz
%{_mandir}/man8/cron.8.gz
%{_mandir}/man8/crond.8.gz
%verify(not mode) %attr (4750,root,trusted) /usr/bin/crontab
%attr (755,root,root) %{_sbindir}/cron
%{_sbindir}/rccron
/usr/lib/cron
%config %{_sysconfdir}/omc/srvinfo.d/cron.xml
%dir %{_sysconfdir}/omc/srvinfo.d/
%dir %{_sysconfdir}/omc/
%dir /lib/systemd
%dir /lib/systemd/system
/lib/systemd/system/cron.service
%files anacron
%defattr(-,root,root,-)
%{_sbindir}/anacron
%attr(0755,root,root) %{_sysconfdir}/cron.hourly/0anacron
%config(noreplace) %{_sysconfdir}/anacrontab
%dir /var/spool/anacron
%ghost %verify(not md5 size mtime) /var/spool/anacron/cron.daily
%ghost %verify(not md5 size mtime) /var/spool/anacron/cron.weekly
%ghost %verify(not md5 size mtime) /var/spool/anacron/cron.monthly
%{_mandir}/man5/anacrontab.*
%{_mandir}/man8/anacron.*
%files -n cron
%defattr(-,root,root,-)
%doc cron_to_cronie.README
%changelog