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