]> git.pld-linux.org Git - packages/fcron.git/blob - fcron.spec
- some cosmetics
[packages/fcron.git] / fcron.spec
1 # TODO:
2 # - added support for selinux
3 # - check %post, %pre
4 Summary:        A periodical command scheduler which aims at replacing Vixie Cron
5 Summary(pl):    Serwer okresowego uruchamiania poleceñ zastepuj±cy Vixie Crona
6 Name:           fcron
7 Version:        2.9.5
8 Release:        0.4
9 License:        GPL
10 Group:          Daemons
11 Source0:        http://fcron.free.fr/archives/%{name}-%{version}.src.tar.gz
12 # Source0-md5:  73042f2666dff27444789d542bbcd607
13 Source1:        %{name}.init
14 Source2:        cron.logrotate
15 Source3:        cron.sysconfig
16 Source4:        %{name}.crontab
17 Source5:        %{name}.pam
18 Source6:        %{name}.conf
19 Source7:        fcrontab.pam    
20 URL:            http://fcron.free.fr/
21 #BuildRequires: libselinux-devel
22 BuildRequires:  pam-devel
23 BuildRequires:  rpmbuild(macros) >= 1.159
24 PreReq:         rc-scripts
25 Requires(pre):  /usr/bin/getgid
26 Requires(pre):  /usr/sbin/groupadd
27 Requires(post,preun):   /sbin/chkconfig
28 Requires(post): fileutils
29 Requires(postun):       /usr/sbin/groupdel
30 Requires:       /bin/run-parts
31 Requires:       psmisc >= 20.1
32 Provides:       crontabs >= 1.7
33 Provides:       crondaemon
34 Provides:       group(crontab)
35 Obsoletes:      crontabs
36 Obsoletes:      crondaemon
37 Obsoletes:      hc-cron
38 Obsoletes:      mcron
39 Obsoletes:      vixie-cron
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %description
43 Fcron is a periodical command scheduler which aims at replacing Vixie
44 Cron, so it implements most of its functionalities. But fcron does not
45 assume that your system is running neither all the time nor regularly:
46 you can, for instance, tell fcron to execute tasks every x hours y
47 minutes of system up time or to do a job only once in a specified
48 interval of time. You can also set a nice value to a job, run it
49 depending on the system load average and much more !
50
51 %description -l pl
52 Fcron jest serwerem okresowego uruchamiania poleceñ maj±cym za cel
53 zast±pienie Vixie Crona, posiadaj±cym zaimplementowane wiêkszo¶æ
54 spo¶ród jego funkcji. Jednak¿e fcron nie zak³ada, ¿e system dzia³a
55 ca³y czas, ani ¿e jest uruchamiany regularnie: mo¿na, na przyk³ad,
56 kazaæ fcronowi uruchamiaæ zadanie co ka¿de x godzin y minut od
57 uruchomienia systemu lub wykonywaæ zadanie dok³adnie raz w podanym
58 okresie czasu. Umo¿liwia równie¿ ustawianie warto¶ci nice dla zadania,
59 uruchamianie go w zale¿no¶ci od obci±¿enia systemu i du¿o wiêcej.
60
61 %prep
62 %setup -q
63
64 %build
65 %configure \
66         --with-spooldir=%{_var}/spool/cron \
67         --with-run-non-privileged=no \
68         --with-boot-install=no \
69         --with-fcrondyn=yes \
70         --with-username=crontab \
71         --with-groupname=crontab \
72         --with-pam=yes \
73         --with-selinux=no \
74         --with-boot-install=no
75
76 %{__make}
77
78 echo "#!/bin/sh" > script/user-group
79
80 %install
81 rm -rf $RPM_BUILD_ROOT
82 install -d $RPM_BUILD_ROOT{/var/{log,spool/cron},%{_mandir}} \
83         $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,sysconfig} \
84         $RPM_BUILD_ROOT%{_sysconfdir}/{cron,cron.{d,hourly,daily,weekly,monthly},pam.d}
85
86 %{__make} install \
87         DESTDIR=$RPM_BUILD_ROOT \
88         DESTSBIN=$RPM_BUILD_ROOT%{_sbindir} \
89         DESTBIN=$RPM_BUILD_ROOT%{_bindir} \
90         DESTMAN=$RPM_BUILD_ROOT%{_mandir} \
91         ROOTNAME=$(id -u) \
92         ROOTGROUP=$(id -g) \
93         USERNAME=$(id -u) \
94         GROUPNAME=$(id -g)
95
96 #fix premission for rpmbuild
97 chmod +rw $RPM_BUILD_ROOT/usr/*bin/*
98
99 ln -sf %{_bindir}/fcrontab $RPM_BUILD_ROOT%{_bindir}/crontab
100 mv -f $RPM_BUILD_ROOT%{_sbindir}/fcron $RPM_BUILD_ROOT%{_sbindir}/crond
101
102 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/crond
103 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/cron
104 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/cron
105 install %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.d/crontab
106 install %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/fcron
107 install %{SOURCE6} $RPM_BUILD_ROOT/etc/fcron.conf
108 install %{SOURCE7} $RPM_BUILD_ROOT/etc/pam.d/fcrontab
109
110 #for a in fi fr id ja ko pl ; do
111 #       if test -f $a/man1/crontab.1 ; then
112 #               install -d $RPM_BUILD_ROOT%{_mandir}/$a/man1
113 #               install $a/man1/crontab.1 $RPM_BUILD_ROOT%{_mandir}/$a/man1
114 #       fi
115 #       if test -f $a/man5/crontab.5 ; then
116 #               install -d $RPM_BUILD_ROOT%{_mandir}/$a/man5
117 #               install $a/man5/crontab.5 $RPM_BUILD_ROOT%{_mandir}/$a/man5
118 #       fi
119 #       if test -f $a/man8/cron.8 ; then
120 #               install -d $RPM_BUILD_ROOT%{_mandir}/$a/man8
121 #               install $a/man8/cron.8 $RPM_BUILD_ROOT%{_mandir}/$a/man8
122 #               echo .so cron.8 > $RPM_BUILD_ROOT%{_mandir}/$a/man8/crond.8
123 #       fi
124 #done
125
126 touch $RPM_BUILD_ROOT/var/log/cron
127
128 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.allow << EOF
129 # cron.allow   This file describes the names of the users which are
130 #               allowed to use the local cron daemon
131 root
132 EOF
133
134 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.deny << EOF2
135 # cron.deny    This file describes the names of the users which are
136 #               NOT allowed to use the local cron daemon
137 EOF2
138
139 %clean
140 rm -rf $RPM_BUILD_ROOT
141
142 %pre
143 if [ -n "`/usr/bin/getgid crontab`" ]; then
144         if [ "`/usr/bin/getgid crontab`" != "117" ]; then
145                 echo "Error: group crontab doesn't have gid=117. Correct this before installing cron." 1>&2
146                 exit 1
147         fi
148 else
149         echo "Adding group crontab GID=117."
150         /usr/sbin/groupadd -g 117 -r -f crontab
151 fi
152
153 if [ -n "`/bin/id -u crontab 2>/dev/null`" ]; then
154         if [ "`/bin/id -u crontab`" != "134" ]; then
155                 echo "Error: user crontab doesn't have uid=134. Correct this before installing %{name}." 1>&2
156                 exit 1
157         fi
158 else
159         /usr/sbin/useradd -u 134 -r -d /var/spool/cron -s /bin/false -c "crontab User" -g crontab crontab 1>&2
160 fi
161
162 %post
163 if [ "$1" = "1" ]; then
164         if [ -d /var/spool/cron ]; then
165                 for FILE in /var/spool/cron/*; do
166                         mv -f $FILE $FILE.orig
167                         USER=`basename $FILE`
168                         chown crontab:crontab $FILE.orig
169                         chmod 640 $FILE.orig
170                         (test ! -z "$USER" && fcrontab -u $USER -z) > /dev/null 2>&1
171                 done
172                 if [ -f /var/spool/cron/root.orig ]; then
173                         chmod 600 /var/spool/cron/root.orig
174                         chown root:root /var/spool/cron/root.orig
175                 fi
176         fi
177 fi
178
179 if [ "$1" = "2" ]; then
180         FILE=`find /var/spool/cron -name \*.orig`
181         for FILE in $FILE; do
182                 BASENAME=`basename $FILE`
183                 USER=`echo "$BASENAME"| sed 's/.orig//'`
184                 [ ! -z "$USER" ] && fcrontab -u $USER -z > /dev/null 2>&1
185         done
186 fi
187
188 /sbin/chkconfig --add crond
189 if [ -f /var/lock/subsys/crond ]; then
190         /etc/rc.d/init.d/crond restart >&2
191 else
192         echo "Run \"/etc/rc.d/init.d/crond start\" to start cron daemon."
193 fi
194
195 umask 027
196 touch /var/log/cron
197 chgrp crontab /var/log/cron
198 chmod 660 /var/log/cron
199
200 %preun
201 if [ "$1" = "0" ]; then
202         if [ -f /var/lock/subsys/crond ]; then
203                 /etc/rc.d/init.d/crond stop >&2
204         fi
205         /sbin/chkconfig --del crond
206
207 rm -f /var/spool/cron/systab*
208
209 FILE=`find /var/spool/cron -name \*.orig`
210 for FILE in $FILE; do
211         BASENAME=`basename $FILE`
212         USER="`echo "$BASENAME"| sed 's/.orig//'`"
213         mv -f $FILE /var/spool/cron/$USER >/dev/null 2>&1
214         chown $USER:crontab /var/spool/cron/$USER >/dev/null 2>&1
215         chmod 600 /var/spool/cron/$USER >/dev/null 2>&1
216 done
217 rm -rf /var/spool/cron/rm.*
218 rm -rf /var/spool/cron/fcrontab.sig
219 fi
220
221 %postun
222 if [ "$1" = "0" ]; then
223         %userremove crontab
224         %groupremove crontab
225 fi
226
227 %triggerpostun -- vixie-cron <= 3.0.1-85
228 for i in `/bin/ls /var/spool/cron 2>/dev/null`
229 do
230         chown ${i} /var/spool/cron/${i} 2>/dev/null || :
231 done
232 /bin/chmod 660 /var/log/cron
233 /bin/chgrp crontab /var/log/cron
234 /bin/chmod 640 /etc/cron/cron.*
235 /bin/chgrp crontab /etc/cron/cron.*
236
237 %triggerpostun -- vixie-cron <= 3.0.1-73
238 if [ -f /etc/cron.d/cron.allow.rpmsave ]; then
239         mv -f /etc/cron.d/cron.allow.rpmsave /etc/cron/cron.allow
240 fi
241 if [ -f /etc/cron.d/cron.allow ]; then
242         mv -f /etc/cron.d/cron.allow /etc/cron/cron.allow
243 fi
244 if [ -f /etc/cron.d/cron.deny.rpmsave ]; then
245         mv -f /etc/cron.d/cron.deny.rpmsave /etc/cron/cron.deny
246 fi
247 if [ -f /etc/cron.d/cron.deny ]; then
248         mv -f /etc/cron.d/cron.deny /etc/cron/cron.deny
249 fi
250
251 %triggerpostun -- vixie-cron <= 3.0.1-70
252 if [ -f /etc/cron.allow ]; then
253         mv -f /etc/cron.allow /etc/cron/cron.allow
254 fi
255 if [ -f /etc/cron.deny ]; then
256         mv -f /etc/cron.deny /etc/cron/cron.deny
257 fi
258
259 %triggerpostun -- hc-cron
260 /sbin/chkconfig --del crond
261 /sbin/chkconfig --add crond
262
263 %triggerpostun -- hc-cron <= 0.14-12
264 for i in `/bin/ls /var/spool/cron 2>/dev/null`
265 do
266         chown ${i} /var/spool/cron/${i} 2>/dev/null || :
267 done
268 /bin/chmod 660 /var/log/cron
269 /bin/chgrp crontab /var/log/cron
270 /bin/chmod 640 /etc/cron/cron.*
271 /bin/chgrp crontab /etc/cron/cron.*
272
273 %files
274 %defattr(644,root,root,755)
275 %doc  doc/HTML doc/olddoc/{FAQ,CHANGES,README,THANKS,TODO}
276 %attr(0750,root,crontab) %dir %{_sysconfdir}/cron*
277 %attr(0644,root,crontab) %config(noreplace) /etc/cron.d/crontab
278 %attr(0640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.allow
279 %attr(0640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.deny
280 %attr(0640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cron
281 %attr(0644,root,crontab) %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/fcron
282 %attr(0644,root,crontab) %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/fcrontab
283 %attr(0754,root,root) /etc/rc.d/init.d/crond
284 %config(noreplace) %verify(not md5 size mtime) %attr(640,root,root) /etc/logrotate.d/cron
285 %attr(0640,root,crontab) %config(noreplace) /etc/fcron.conf
286 %attr(0755,root,root) %{_sbindir}/crond
287 %attr(6111,crontab,crontab) %{_bindir}/fcrontab
288 %attr(6111,crontab,crontab) %{_bindir}/crontab
289 %attr(4711,root,root) %{_bindir}/fcronsighup
290 %attr(6111,crontab,crontab) %{_bindir}/fcrondyn
291
292 %{_mandir}/man*/*
293 #%%lang(fi) %{_mandir}/fi/man*/*
294 #%%lang(fr) %{_mandir}/fr/man*/*
295 #%%lang(id) %{_mandir}/id/man*/*
296 #%%lang(ja) %{_mandir}/ja/man*/*
297 #%%lang(ko) %{_mandir}/ko/man*/*
298 #%%lang(pl) %{_mandir}/pl/man*/*
299
300 %attr(1730,root,crontab) /var/spool/cron
301 %attr(0660,root,crontab) %ghost /var/log/cron
This page took 0.099726 seconds and 4 git commands to generate.