]> git.pld-linux.org Git - packages/cronie.git/blob - cronie.spec
- clear systemd macros when systemd is off
[packages/cronie.git] / cronie.spec
1 # TODO
2 # - update paths in manuals (create .in files and send upstream)
3 # - make /etc/pam.d independant of sysconfdir (configure-able option and send upstream)
4 # - syslog output (-s) writes two bytes of garbage to syslog instead of actual data:
5 #   Mar  3 09:30:01 ravenous CROND[2528]: 4ΓΏ
6 #
7 # Conditional build:
8 %bcond_without  inotify         # without inotify support
9 %if "%{pld_release}" == "ac"
10 %bcond_with             selinux         # with SELinux support
11 %bcond_with             audit           # with audit support
12 %bcond_with             systemd         # with systemd units
13 %else
14 %bcond_without  selinux         # without SELinux support
15 %bcond_without  audit           # without audit support
16 %bcond_with             systemd         # without systemd units
17 %endif
18
19 %if %{without systemd}
20 %define systemd_post() %{nil}
21 %define systemd_preun() %{nil}
22 %define systemd_reload() %{nil}
23 %define systemd_trigger() %{nil}
24 %endif
25
26 Summary:        Cron daemon for executing programs at set times
27 Name:           cronie
28 Version:        1.4.8
29 Release:        17
30 License:        MIT and BSD and GPL v2
31 Group:          Daemons
32 Source0:        https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.gz
33 # Source0-md5:  9b1d2ce6db8d1883e06635f437170657
34 Source1:        %{name}.init
35 Source2:        cron.logrotate
36 Source3:        cron.sysconfig
37 Source4:        %{name}.crontab
38 Source5:        %{name}.pam
39 Source6:        %{name}.upstart
40 Source7:        crond.service
41 Patch0:         inotify-nosys.patch
42 Patch1:         %{name}-nosyscrontab.patch
43 Patch2:         sendmail-path.patch
44 Patch3:         cronie-1.4.8-inotify-fix.patch
45 URL:            https://fedorahosted.org/cronie/
46 %{?with_audit:BuildRequires:    audit-libs-devel}
47 BuildRequires:  autoconf
48 BuildRequires:  automake
49 %{?with_selinux:BuildRequires:  libselinux-devel}
50 BuildRequires:  pam-devel
51 BuildRequires:  rpm >= 4.4.9-56
52 BuildRequires:  rpmbuild(macros) >= 1.626
53 Requires(post): fileutils
54 Requires(post,preun):   /sbin/chkconfig
55 Requires(postun):       /usr/sbin/groupdel
56 Requires(pre):  /usr/bin/getgid
57 Requires(pre):  /usr/sbin/groupadd
58 Requires:       /bin/run-parts
59 Requires:       psmisc >= 20.1
60 Requires:       rc-scripts >= 0.4.3.0
61 %{?with_systemd:Requires:       systemd-units >= 37-0.10}
62 %{?with_inotify:Requires:       uname(release) >= 2.6.13}
63 Provides:       crondaemon
64 Provides:       crontabs = 1.7
65 Provides:       group(crontab)
66 %if "%{pld_release}" == "th"
67 Provides:       vixie-cron = 4.3-1
68 %endif
69 Obsoletes:      crondaemon
70 Obsoletes:      cronie-systemd
71 Obsoletes:      crontabs
72 %if "%{pld_release}" == "th"
73 Obsoletes:      vixie-cron < 4.3-1
74 %endif
75 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
76
77 %description
78 Cronie contains the standard UNIX daemon crond that runs specified
79 programs at scheduled times and related tools. It is based on the
80 original cron and has security and configuration enhancements like the
81 ability to use pam and SELinux.
82
83 %package anacron
84 Summary:        Utility for running regular jobs
85 Group:          Base
86 Provides:       anacron = 2.4
87 Obsoletes:      anacron <= 2.3
88
89 %description anacron
90 Anacron becames part of cronie. Anacron is used only for running
91 regular jobs. The default settings execute regular jobs by anacron,
92 however this could be overloaded in settings.
93
94 %package upstart
95 Summary:        Upstart job description for Cronie
96 Summary(pl.UTF-8):      Opis zadania Upstart dla Cronie
97 Group:          Daemons
98 Requires:       %{name} = %{version}-%{release}
99 Requires:       upstart >= 0.6
100
101 %description upstart
102 Upstart job description for Cronie.
103
104 %description upstart -l pl.UTF-8
105 Opis zadania Upstart dla Cronie.
106
107 %prep
108 %setup -q
109 %patch0 -p1
110 %patch1 -p1
111 %patch2 -p1
112 %patch3 -p1
113
114 %build
115 %{__aclocal}
116 %{__autoconf}
117 %{__autoheader}
118 %{__automake}
119 %configure \
120         SYSCRONTAB=/etc/crontab \
121         SYS_CROND_DIR=/etc/cron.d \
122         --sysconfdir=/etc/cron \
123         --with-pam \
124         --with%{!?with_selinux:out}-selinux \
125         --with%{!?with_audit:out}-audit \
126         --with%{!?with_inotify:out}-inotify \
127 %if "%{cc_version}" >= "3.4"
128         --enable-pie \
129 %endif
130         --enable-relro \
131         --enable-anacron
132
133 %{__make}
134
135 %install
136 rm -rf $RPM_BUILD_ROOT
137 install -d $RPM_BUILD_ROOT{/var/{log,spool/{ana,}cron},%{_mandir},%{systemdunitdir}}\
138         $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,sysconfig,init} \
139         $RPM_BUILD_ROOT%{_sysconfdir}/{cron,cron.{d,hourly,daily,weekly,monthly},pam.d}
140
141 %{__make} install \
142         pamdir=/etc/pam.d \
143         DESTDIR=$RPM_BUILD_ROOT
144
145 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/crond
146 cp -a contrib/0anacron $RPM_BUILD_ROOT/etc/cron.hourly/0anacron
147 cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/cron
148 cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/cron
149 cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.d/crontab
150 cp -a %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/crond
151 cp -a %{SOURCE6} $RPM_BUILD_ROOT/etc/init/crond.conf
152 cp -a %{SOURCE7} $RPM_BUILD_ROOT%{systemdunitdir}/crond.service
153
154 touch $RPM_BUILD_ROOT/var/log/cron
155
156 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.allow << 'EOF'
157 # cron.allow    This file describes the names of the users which are
158 #               allowed to use the local cron daemon
159 root
160 EOF
161
162 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.deny << 'EOF'
163 # cron.deny     This file describes the names of the users which are
164 #               NOT allowed to use the local cron daemon
165 EOF
166
167 %clean
168 rm -rf $RPM_BUILD_ROOT
169
170 %pre
171 %groupadd -g 117 -r -f crontab
172
173 %post
174 if [ ! -f /var/log/cron ]; then
175         install -m 660 -g crontab /dev/null /var/log/cron
176 fi
177 /sbin/chkconfig --add crond
178 %service crond restart "Cron Daemon"
179 %systemd_post crond.service
180
181 %preun
182 if [ "$1" = "0" ]; then
183         %service crond stop
184         /sbin/chkconfig --del crond
185 fi
186 %systemd_preun crond.service
187
188 %postun
189 if [ "$1" = "0" ]; then
190         %groupremove crontab
191 fi
192 %systemd_reload
193
194 %triggerpostun -- cronie < 1.4.8-13
195 if [ -f /etc/sysconfig/cron ]; then
196         . /etc/sysconfig/cron
197         __CROND_ARGS=
198         [ "$CROND_SYSLOG_RESULT" = "yes" ] && __CROND_ARGS="-s"
199         [ -n "$CROND_MAIL_PROG" ] && __CROND_ARGS="$__CROND_ARGS -m $CROND_MAIL_PROG"
200         if [ -n "$__CROND_ARGS" ]; then
201                 %{__cp} -f /etc/sysconfig/cron{,.rpmsave}
202                 echo >>/etc/sysconfig/cron
203                 echo "# Added by rpm trigger" >>/etc/sysconfig/cron
204                 echo "CROND_ARGS=\"$CROND_ARGS $__CROND_ARGS\"" >>/etc/sysconfig/cron
205         fi
206 fi
207 %systemd_trigger crond.service
208
209 %triggerun -- hc-cron,fcron,vixie-cron
210 # Prevent preun from crond from working
211 chmod a-x /etc/rc.d/init.d/crond
212
213 %triggerpostun -- hc-cron,fcron,vixie-cron
214 # Restore what triggerun removed
215 chmod 754 /etc/rc.d/init.d/crond
216 # reinstall crond init.d links, which could be different
217 /sbin/chkconfig --del crond
218 /sbin/chkconfig --add crond
219
220 %post upstart
221 %upstart_post crond
222
223 %postun upstart
224 %upstart_postun crond
225
226 %files
227 %defattr(644,root,root,755)
228 %doc AUTHORS ChangeLog README
229 %attr(750,root,crontab) %dir %{_sysconfdir}/cron*
230 %attr(640,root,crontab) %config(noreplace,missingok) /etc/cron.d/crontab
231 %attr(640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.allow
232 %attr(640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.deny
233 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cron
234 %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/crond
235 %attr(754,root,root) /etc/rc.d/init.d/crond
236 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/cron
237 %{?with_systemd:%{systemdunitdir}/crond.service}
238 %attr(755,root,root) %{_sbindir}/crond
239 %attr(2755,root,crontab) %{_bindir}/crontab
240
241 %{_mandir}/man8/crond.8*
242 %{_mandir}/man8/cron.8*
243 %{_mandir}/man5/crontab.5*
244 %{_mandir}/man1/crontab.1*
245
246 %attr(1730,root,crontab) /var/spool/cron
247 %attr(660,root,crontab) %ghost /var/log/cron
248
249 %files anacron
250 %defattr(644,root,root,755)
251 %attr(755,root,root) %{_sbindir}/anacron
252 %attr(755,root,root) %{_sysconfdir}/cron.hourly/0anacron
253 %{_mandir}/man5/anacrontab.5*
254 %{_mandir}/man8/anacron.8*
255
256 %attr(1730,root,crontab) /var/spool/anacron
257
258 %if "%{pld_release}" == "th"
259 %files upstart
260 %defattr(644,root,root,755)
261 %config(noreplace) %verify(not md5 mtime size) /etc/init/crond.conf
262 %endif
This page took 0.053789 seconds and 3 git commands to generate.