]> git.pld-linux.org Git - packages/fcron.git/blob - fcron.spec
- added scripts in preun, post for compatible with other crons
[packages/fcron.git] / fcron.spec
1 # TODO:
2 # - write missing files
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.1
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=root \
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
97 #fix premission for rpmbuild
98 chmod +rw $RPM_BUILD_ROOT/usr/*bin/*
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
108 #for a in fi fr id ja ko pl ; do
109 #       if test -f $a/man1/crontab.1 ; then
110 #               install -d $RPM_BUILD_ROOT%{_mandir}/$a/man1
111 #               install $a/man1/crontab.1 $RPM_BUILD_ROOT%{_mandir}/$a/man1
112 #       fi
113 #       if test -f $a/man5/crontab.5 ; then
114 #               install -d $RPM_BUILD_ROOT%{_mandir}/$a/man5
115 #               install $a/man5/crontab.5 $RPM_BUILD_ROOT%{_mandir}/$a/man5
116 #       fi
117 #       if test -f $a/man8/cron.8 ; then
118 #               install -d $RPM_BUILD_ROOT%{_mandir}/$a/man8
119 #               install $a/man8/cron.8 $RPM_BUILD_ROOT%{_mandir}/$a/man8
120 #               echo .so cron.8 > $RPM_BUILD_ROOT%{_mandir}/$a/man8/crond.8
121 #       fi
122 #done
123
124 touch $RPM_BUILD_ROOT/var/log/cron
125
126 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.allow << EOF
127 # cron.allow   This file describes the names of the users which are
128 #               allowed to use the local cron daemon
129 root
130 EOF
131
132 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.deny << EOF2
133 # cron.deny    This file describes the names of the users which are
134 #               NOT allowed to use the local cron daemon
135 EOF2
136
137 %clean
138 rm -rf $RPM_BUILD_ROOT
139
140 %pre
141 if [ -n "`/usr/bin/getgid crontab`" ]; then
142         if [ "`/usr/bin/getgid crontab`" != "117" ]; then
143                 echo "Error: group crontab doesn't have gid=117. Correct this before installing cron." 1>&2
144                 exit 1
145         fi
146 else
147         echo "Adding group crontab GID=117."
148         /usr/sbin/groupadd -g 117 -r -f crontab
149 fi
150
151 %post
152 for FILE in /var/spool/cron/*; do
153                 mv -f $FILE $FILE.orig
154                 BASENAME=`basename $FILE`
155                 FCRONTAB=`echo "$BASENAME"`
156                 (test ! -z "$FCRONTAB" && fcrontab -u $FCRONTAB -z) > /dev/null 2>&1
157 done
158
159 /sbin/chkconfig --add crond
160 if [ -f /var/lock/subsys/crond ]; then
161         /etc/rc.d/init.d/crond restart >&2
162 else
163         echo "Run \"/etc/rc.d/init.d/crond start\" to start cron daemon."
164 fi
165 umask 027
166 touch /var/log/cron
167 chgrp crontab /var/log/cron
168 chmod 660 /var/log/cron
169
170 %preun
171 if [ "$1" = "0" ]; then
172         if [ -f /var/lock/subsys/crond ]; then
173                 /etc/rc.d/init.d/crond stop >&2
174         fi
175         /sbin/chkconfig --del crond
176 fi
177
178 for FILE in /var/spool/cron/*.orig; do
179                 BASENAME=`basename $FILE`
180                 mv -f $FILE /var/spool/cron/`echo "$BASENAME"| sed 's/.orig//'` >/dev/null 2>&1
181 done
182
183 %postun
184 if [ "$1" = "0" ]; then
185         %groupremove crontab
186 fi
187
188 %triggerpostun -- vixie-cron <= 3.0.1-85
189 for i in `/bin/ls /var/spool/cron 2>/dev/null`
190 do
191         chown ${i} /var/spool/cron/${i} 2>/dev/null || :
192 done
193 /bin/chmod 660 /var/log/cron
194 /bin/chgrp crontab /var/log/cron
195 /bin/chmod 640 /etc/cron/cron.*
196 /bin/chgrp crontab /etc/cron/cron.*
197
198 %triggerpostun -- vixie-cron <= 3.0.1-73
199 if [ -f /etc/cron.d/cron.allow.rpmsave ]; then
200         mv -f /etc/cron.d/cron.allow.rpmsave /etc/cron/cron.allow
201 fi
202 if [ -f /etc/cron.d/cron.allow ]; then
203         mv -f /etc/cron.d/cron.allow /etc/cron/cron.allow
204 fi
205 if [ -f /etc/cron.d/cron.deny.rpmsave ]; then
206         mv -f /etc/cron.d/cron.deny.rpmsave /etc/cron/cron.deny
207 fi
208 if [ -f /etc/cron.d/cron.deny ]; then
209         mv -f /etc/cron.d/cron.deny /etc/cron/cron.deny
210 fi
211
212 %triggerpostun -- vixie-cron <= 3.0.1-70
213 if [ -f /etc/cron.allow ]; then
214         mv -f /etc/cron.allow /etc/cron/cron.allow
215 fi
216 if [ -f /etc/cron.deny ]; then
217         mv -f /etc/cron.deny /etc/cron/cron.deny
218 fi
219
220 %triggerpostun -- hc-cron
221 /sbin/chkconfig --del crond
222 /sbin/chkconfig --add crond
223
224 %triggerpostun -- hc-cron <= 0.14-12
225 for i in `/bin/ls /var/spool/cron 2>/dev/null`
226 do
227         chown ${i} /var/spool/cron/${i} 2>/dev/null || :
228 done
229 /bin/chmod 660 /var/log/cron
230 /bin/chgrp crontab /var/log/cron
231 /bin/chmod 640 /etc/cron/cron.*
232 /bin/chgrp crontab /etc/cron/cron.*
233
234 %files
235 %defattr(644,root,root,755)
236 #%%doc CHANGES CONVERSION FEATURES MAIL README THANKS
237 %attr(0750,root,crontab) %dir %{_sysconfdir}/cron*
238 %attr(0644,root,crontab) %config(noreplace) /etc/cron.d/crontab
239 %attr(0640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.allow
240 %attr(0640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.deny
241 %attr(0640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cron
242 %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/fcron
243 %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/fcrontab
244 %attr(0754,root,root) /etc/rc.d/init.d/crond
245 %config /etc/logrotate.d/cron
246 %attr(0640,root,root) %config(noreplace) /etc/fcron.conf
247 %attr(0755,root,root) %{_sbindir}/fcron
248 %attr(4755,root,crontab) %{_bindir}/fcrontab
249 %attr(0755,root,crontab) %{_bindir}/fcronsighup
250 %attr(0755,root,crontab) %{_bindir}/fcrondyn
251
252 %{_mandir}/man*/*
253 #%%lang(fi) %{_mandir}/fi/man*/*
254 #%%lang(fr) %{_mandir}/fr/man*/*
255 #%%lang(id) %{_mandir}/id/man*/*
256 #%%lang(ja) %{_mandir}/ja/man*/*
257 #%%lang(ko) %{_mandir}/ko/man*/*
258 #%%lang(pl) %{_mandir}/pl/man*/*
259
260 %attr(1730,root,crontab) /var/spool/cron
261 %attr(0660,root,crontab) %ghost /var/log/cron
This page took 0.316872 seconds and 3 git commands to generate.