]> git.pld-linux.org Git - packages/fcron.git/blob - fcron.spec
Up to 3.3.1
[packages/fcron.git] / fcron.spec
1 # TODO
2 # - use libbsd-devel? (bitstring at least?)
3 Summary:        A periodical command scheduler which aims at replacing Vixie Cron
4 Summary(pl.UTF-8):      Serwer okresowego uruchamiania poleceń zastępujący Vixie Crona
5 Name:           fcron
6 Version:        3.3.1
7 Release:        1
8 License:        GPL v2+
9 Group:          Daemons
10 Source0:        http://fcron.free.fr/archives/%{name}-%{version}.src.tar.gz
11 # Source0-md5:  2e95ceb98842393232e062e9cb1346b7
12 Source1:        %{name}.init
13 Source3:        cron.sysconfig
14 Source4:        %{name}.crontab
15 Source5:        %{name}.pam
16 Source6:        %{name}.conf
17 Source7:        %{name}tab.pam
18 Source8:        %{name}.systab
19 Patch0:         %{name}-sendmail.patch
20 Patch1:         %{name}-Makefile.patch
21 Patch2:         %{name}-accept_readable_fcron.conf.patch
22 URL:            http://fcron.free.fr/
23 # configure tests -x (check can be removed, just like sendmail)
24 BuildRequires:  /bin/vi
25 BuildRequires:  autoconf
26 BuildRequires:  automake
27 BuildRequires:  libselinux-devel
28 BuildRequires:  pam-devel
29 BuildRequires:  rpmbuild(macros) >= 1.268
30 Requires(post): fileutils
31 Requires(post,preun):   /sbin/chkconfig
32 Requires(postun):       /usr/sbin/groupdel
33 Requires(pre):  /bin/id
34 Requires(pre):  /usr/bin/getgid
35 Requires(pre):  /usr/sbin/groupadd
36 Requires(pre):  /usr/sbin/useradd
37 Requires:       /bin/run-parts
38 Requires:       psmisc >= 20.1
39 Requires:       rc-scripts
40 Provides:       crondaemon
41 Provides:       cronjobs
42 Provides:       crontabs = 1.7
43 Provides:       group(crontab)
44 Obsoletes:      crondaemon
45 Obsoletes:      cronjobs
46 Obsoletes:      crontabs
47 Conflicts:      sysklogd < 1.5.1-2
48 Conflicts:      syslog-ng < 3.6.4-3
49 Conflicts:      rsyslog < 5.10.1-4
50 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51
52 %description
53 Fcron is a periodical command scheduler which aims at replacing Vixie
54 Cron, so it implements most of its functionalities. But fcron does not
55 assume that your system is running neither all the time nor regularly:
56 you can, for instance, tell fcron to execute tasks every x hours y
57 minutes of system up time or to do a job only once in a specified
58 interval of time. You can also set a nice value to a job, run it
59 depending on the system load average and much more !
60
61 %description -l pl.UTF-8
62 Fcron jest serwerem okresowego uruchamiania poleceń mającym za cel
63 zastąpienie Vixie Crona, posiadającym zaimplementowane większość
64 spośród jego funkcji. Jednakże fcron nie zakłada, że system działa
65 cały czas, ani że jest uruchamiany regularnie: można, na przykład,
66 kazać fcronowi uruchamiać zadanie co każde x godzin y minut od
67 uruchomienia systemu lub wykonywać zadanie dokładnie raz w podanym
68 okresie czasu. Umożliwia również ustawianie wartości nice dla zadania,
69 uruchamianie go w zależności od obciążenia systemu i dużo więcej.
70
71 %prep
72 %setup -q
73 %patch0 -p1
74 %patch1 -p1
75 %patch2 -p0
76
77 %build
78 %{__aclocal}
79 %{__autoconf}
80 %configure \
81         --with-sendmail=/usr/sbin/sendmail \
82         --with-sysfcrontab=systab \
83         --with-spooldir=%{_var}/spool/cron \
84         --with-run-non-privileged=no \
85         --with-boot-install=no \
86         --with-fcrondyn=yes \
87         --with-username=crontab \
88         --with-groupname=crontab \
89         --with-pam=yes \
90         --with-selinux=yes \
91         --with-boot-install=no \
92         --with-editor=/bin/vi
93
94 %{__make} \
95         OPTION="%{rpmcflags}"
96
97 echo "#!/bin/sh" > script/user-group
98
99 %install
100 rm -rf $RPM_BUILD_ROOT
101 install -d $RPM_BUILD_ROOT{/var/{log,spool/cron},%{_mandir}} \
102         $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,sysconfig} \
103         $RPM_BUILD_ROOT%{_sysconfdir}/{cron,cron.{d,hourly,daily,weekly,monthly},pam.d}
104
105 %{__make} install-staged \
106         DESTDIR=$RPM_BUILD_ROOT \
107         ROOTNAME=$(id -u) \
108         ROOTGROUP=$(id -g) \
109         USERNAME=$(id -u) \
110         GROUPNAME=$(id -g)
111
112 #fix premission for rpmbuild
113 chmod +rw $RPM_BUILD_ROOT%{_prefix}/*bin/*
114
115 ln -sf %{_bindir}/fcrontab $RPM_BUILD_ROOT%{_bindir}/crontab
116 mv -f $RPM_BUILD_ROOT%{_sbindir}/fcron $RPM_BUILD_ROOT%{_sbindir}/crond
117
118 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/crond
119 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/cron
120 install %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.d/crontab
121 install %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/fcron
122 install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/fcron.conf
123 install %{SOURCE7} $RPM_BUILD_ROOT/etc/pam.d/fcrontab
124 install %{SOURCE8} $RPM_BUILD_ROOT/etc/cron.hourly/fcron.systab
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 << 'EOF'
133 # cron.deny     This file describes the names of the users which are
134 #               NOT allowed to use the local cron daemon
135 EOF
136
137 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
138
139 # conflicts with libbsd-devel-0.7.0-2.x86_64
140 %{__rm} $RPM_BUILD_ROOT/usr/share/man/man3/bitstring.3*
141
142 %clean
143 rm -rf $RPM_BUILD_ROOT
144
145 %pre
146 %groupadd -g 117 -r -f crontab
147 %useradd -u 134 -r -d /var/spool/cron -s /bin/false -c "crontab User" -g crontab crontab
148
149 %post
150 if [ "$1" = "1" ]; then
151         if [ -d /var/spool/cron ]; then
152                 FIND=`find /var/spool/cron -type f`
153                 for FILE in $FIND; do
154                         mv -f $FILE $FILE.orig
155                         USER=`basename $FILE`
156                         chown crontab:crontab $FILE.orig
157                         chmod 640 $FILE.orig
158                         (test ! -z "$USER" && fcrontab -u $USER -z) > /dev/null 2>&1
159                 done
160                 if [ -f /var/spool/cron/root.orig ]; then
161                         chmod 600 /var/spool/cron/root.orig
162                         chown root:root /var/spool/cron/root.orig
163                 fi
164         fi
165 fi
166
167 if [ "$1" = "2" ]; then
168         FIND=`find /var/spool/cron -name \*.orig`
169         for FILE in $FIND; do
170                 BASENAME=`basename $FILE`
171                 USER=`echo "$BASENAME"| sed 's/.orig//'`
172                 [ ! -z "$USER" ] && fcrontab -u $USER -z > /dev/null 2>&1
173         done
174 fi
175
176 /sbin/chkconfig --add crond
177 %service crond restart "Cron Daemon"
178
179 %preun
180 if [ "$1" = "0" ]; then
181         %service crond stop
182         /sbin/chkconfig --del crond
183
184         rm -f /var/spool/cron/systab*
185
186         FIND=`find /var/spool/cron -name '*.orig'`
187         for FILE in $FIND; do
188                 BASENAME=`basename $FILE`
189                 USER="${BASENAME%.orig}"
190                 mv -f $FILE /var/spool/cron/$USER >/dev/null 2>&1
191                 chown $USER:crontab /var/spool/cron/$USER >/dev/null 2>&1
192                 chmod 600 /var/spool/cron/$USER >/dev/null 2>&1
193         done
194         rm -f /var/spool/cron/rm.*
195         rm -f /var/spool/cron/fcrontab.sig
196         rm -f /var/spool/cron/new.*
197 fi
198
199 %postun
200 if [ "$1" = "0" ]; then
201         %userremove crontab
202         %groupremove crontab
203 fi
204
205 %triggerun -- hc-cron,vixie-cron,cronie
206 # Prevent preun from crond from working
207 chmod a-x /etc/rc.d/init.d/crond
208
209 %triggerpostun -- hc-cron,vixie-cron,cronie
210 # Restore what triggerun removed
211 chmod 754 /etc/rc.d/init.d/crond
212 # reinstall crond init.d links, which could be different
213 /sbin/chkconfig --del crond
214 /sbin/chkconfig --add crond
215
216 %files
217 %defattr(644,root,root,755)
218 %doc doc/en/HTML doc/en/txt/{faq.txt,changes.txt,readme.txt,thanks.txt,todo.txt}
219 %attr(750,root,crontab) %dir %{_sysconfdir}/cron*
220 %attr(750,root,root) %{_sysconfdir}/cron.hourly/%{name}.systab
221 %attr(640,root,crontab) %config(noreplace) /etc/cron.d/crontab
222 %attr(640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.allow
223 %attr(640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.deny
224 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cron
225 %attr(644,root,crontab) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/fcron
226 %attr(644,root,crontab) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/fcrontab
227 %attr(754,root,root) /etc/rc.d/init.d/crond
228 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fcron.allow
229 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fcron.deny
230 %attr(640,root,crontab) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fcron.conf
231 %attr(755,root,root) %{_sbindir}/crond
232 %attr(6111,crontab,crontab) %{_bindir}/fcrontab
233 %attr(6111,crontab,crontab) %{_bindir}/crontab
234 %attr(4711,root,root) %{_bindir}/fcronsighup
235 %attr(6111,crontab,crontab) %{_bindir}/fcrondyn
236 %{_mandir}/man1/fcrondyn.1*
237 %{_mandir}/man1/fcrontab.1*
238 %{_mandir}/man5/fcron.conf.5*
239 %{_mandir}/man5/fcrontab.5*
240 %{_mandir}/man8/fcron.8*
241 %lang(fr) %{_mandir}/fr/man1/fcrondyn.1*
242 %lang(fr) %{_mandir}/fr/man1/fcrontab.1*
243 %lang(fr) %{_mandir}/fr/man5/fcron.conf.5*
244 %lang(fr) %{_mandir}/fr/man5/fcrontab.5*
245 %lang(fr) %{_mandir}/fr/man8/fcron.8*
246 %attr(1730,root,crontab) /var/spool/cron
This page took 0.385639 seconds and 4 git commands to generate.