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