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