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