1 |
Summary: Task scheduler |
2 |
Name: fcron |
3 |
Version: 3.0.4 |
4 |
Release: %mkrel 12 |
5 |
License: GPL |
6 |
Group: System/Configuration |
7 |
URL: http://fcron.free.fr/ |
8 |
Source0: http://fcron.free.fr/archives/%{name}-%{version}.src.tar.gz |
9 |
Source1: %{name}-2.0.0-extra.tar.bz2 |
10 |
Patch0: fcron-3.0.3-Makefile.in.diff |
11 |
# (fc) 3.0.4-5mdv accept fcron.conf file with 644 perms (Fedora) |
12 |
Patch1: fcron-3.0.2-accept_readable_fcron.conf.patch |
13 |
Patch2: fcron-3.0.4-lsb.patch |
14 |
BuildRequires: pam-devel |
15 |
BuildRequires: sendmail-command |
16 |
BuildRequires: vim-minimal |
17 |
Requires(post): systemd >= %{systemd_required_version} |
18 |
Requires(post): rpm-helper |
19 |
Requires(preun): rpm-helper |
20 |
Requires(pre): rpm-helper |
21 |
Requires(postun): rpm-helper |
22 |
Requires: syslog-daemon |
23 |
Requires: sendmail-command |
24 |
Provides: cron-daemon |
25 |
BuildConflicts: libselinux-devel |
26 |
|
27 |
%description |
28 |
Fcron is a scheduler. It aims at replacing Vixie Cron, so it implements most |
29 |
of its functionalities. |
30 |
|
31 |
But contrary to Vixie Cron, fcron does not need your system to be up 7 days |
32 |
a week, 24 hours a day : it also works well with systems which are |
33 |
not running neither all the time nor regularly (contrary to anacrontab). |
34 |
|
35 |
In other words, fcron does both the job of Vixie Cron and anacron, but does |
36 |
even more and better :)) ... |
37 |
|
38 |
%prep |
39 |
%setup -q -T -b 0 -n %{name}-%{version} -a1 |
40 |
mv %{name}-2.0.0-extra/fcrontab.example ./ |
41 |
|
42 |
%patch0 -p0 |
43 |
%patch1 -p0 -b .readable-file |
44 |
%patch2 -p1 -b .lsb |
45 |
|
46 |
%build |
47 |
|
48 |
%configure2_5x \ |
49 |
--with-sendmail=/bin/false \ |
50 |
--with-shell=/bin/sh \ |
51 |
--with-editor=/bin/vi \ |
52 |
--with-etcdir=%{_sysconfdir} \ |
53 |
--with-spooldir=/var/spool/fcron \ |
54 |
--with-run-non-privileged=no \ |
55 |
--with-username=fcron \ |
56 |
--with-groupname=fcron \ |
57 |
--with-sysfcrontab=yes \ |
58 |
--with-pam=yes \ |
59 |
--with-selinux=no |
60 |
|
61 |
perl -pi \ |
62 |
-e 's|^#define SENDMAIL .*|#define SENDMAIL "%{_libdir}/sendmail"|;' \ |
63 |
-e 's|^#define PIDFILE .*|#define PIDFILE "/run/fcron/fcron.pid"|;' \ |
64 |
-e 's|^#define FIFOFILE .*|#define FIFOFILE "/run/fcron/fcron.fifo"|;' \ |
65 |
config.h |
66 |
|
67 |
%make OPTIM="%{optflags} -I%{_includedir}/selinux" |
68 |
|
69 |
%install |
70 |
install -d %{buildroot}%{_docdir} |
71 |
install -d %{buildroot}%{_sysconfdir}/pam.d |
72 |
install -d %{buildroot}%{_bindir} |
73 |
install -d %{buildroot}%{_sbindir} |
74 |
install -d %{buildroot}%{_mandir}/man{1,3,5,8} |
75 |
install -d %{buildroot}%{_initrddir} |
76 |
install -d %{buildroot}/var/spool/fcron |
77 |
|
78 |
yes n | make install \ |
79 |
DESTDIR=%{buildroot} \ |
80 |
ROOTNAME=`id -un` ROOTGROUP=`id -gn` |
81 |
|
82 |
%if 0 |
83 |
ETC=%{buildroot}%{_sysconfdir} \ |
84 |
DESTBIN=%{buildroot}%{_bindir} \ |
85 |
DESTSBIN=%{buildroot}%{_sbindir} \ |
86 |
DESTMAN=%{buildroot}%{_mandir} \ |
87 |
DESTDOC=%{buildroot}%{_docdir} \ |
88 |
FCRONTABS=%{buildroot}/var/spool/fcron \ |
89 |
%endif |
90 |
|
91 |
install -m 755 script/sysVinit-launcher %{buildroot}%{_initrddir}/fcron |
92 |
install -m 755 convert-fcrontab %{buildroot}%{_bindir} |
93 |
|
94 |
install -m755 debian/fcron-update-crontabs %{buildroot}%{_sbindir}/ |
95 |
install -m644 debian/fcron-update-crontabs.1 %{buildroot}%{_mandir}/man1/ |
96 |
|
97 |
install -m644 files/fcron.pam %{buildroot}%{_sysconfdir}/pam.d/fcron |
98 |
install -m644 files/fcrontab.pam %{buildroot}%{_sysconfdir}/pam.d/fcrontab |
99 |
|
100 |
|
101 |
# fixup |
102 |
perl -pi -e 's|SBIN=@@DESTSBIN@|SBIN=%{_sbindir}|' \ |
103 |
%{buildroot}%{_initrddir}/fcron |
104 |
perl -pi \ |
105 |
-e "s|^pidfile.*|pidfile = /run/fcron/fcron\.pid|;" \ |
106 |
-e "s|^fifofile.*|fifofile = /run/fcron/fcron\.fifo|;" \ |
107 |
%{buildroot}%{_sysconfdir}/fcron.conf |
108 |
|
109 |
# nuke installed files |
110 |
rm -rf %{buildroot}%{_docdir}/%{name}-%{version} |
111 |
rm -f %{buildroot}%{_sysconfdir}/pam.conf |
112 |
|
113 |
# nuke permissions (for strip) |
114 |
chmod 755 %{buildroot}%{_bindir}/* |
115 |
chmod 755 %{buildroot}%{_sbindir}/* |
116 |
|
117 |
mkdir -p %{buildroot}%{_tmpfilesdir} |
118 |
cat <<EOF > %{buildroot}%{_tmpfilesdir}/%{name}.conf |
119 |
d /run/fcron 0755 root root |
120 |
EOF |
121 |
|
122 |
%pre |
123 |
# Check now if there is an old ( < 1.1.x ) version of fcrontab on the system. |
124 |
echo `fcron -V 2>&1 | grep "^fcron "` > /tmp/PREVIOUS_VERSION |
125 |
|
126 |
if [ "$1" = "1" ]; then |
127 |
%_pre_useradd fcron /var/spool/fcron /bin/true |
128 |
|
129 |
fi |
130 |
|
131 |
%post |
132 |
%_tmpfilescreate %{name} |
133 |
if [ "$1" = "2" ]; then |
134 |
|
135 |
killall -TERM fcron |
136 |
FCRONTABS=/var/spool/fcron |
137 |
|
138 |
find ${FCRONTABS} -type f \( -name "*.orig" -a ! -name "root.orig" \) \ |
139 |
-exec chown fcron:fcron {} \; -exec chmod 640 {} \; |
140 |
find ${FCRONTABS} -type f -name "root.orig" -exec chown root:fcron {} \; -exec chmod 600 {} \; |
141 |
find ${FCRONTABS} -type f ! -name "*.orig" -exec chown root:root {} \; -exec chmod 600 {} \; |
142 |
[ -f %{_sysconfdir}/fcron.deny ] && chown root:fcron %{_sysconfdir}/fcron.deny |
143 |
[ -f %{_sysconfdir}/fcron.allow ] && chown root:fcron %{_sysconfdir}/fcron.allow |
144 |
|
145 |
if test -r "/tmp/PREVIOUS_VERSION"; then |
146 |
|
147 |
MAJOR=`cat /tmp/PREVIOUS_VERSION | awk '{print $2}' | awk -F '.' '{print $1}'` |
148 |
MINOR=`cat /tmp/PREVIOUS_VERSION | awk '{print $2}' | awk -F '.' '{print $2}'` |
149 |
|
150 |
fi |
151 |
|
152 |
if test \( "$MAJOR" -lt 1 \) -o \( \( "$MINOR" -lt 1 \) -a "$MAJOR" -eq 1 \); then |
153 |
|
154 |
for FILE in $FCRONTABS/* ; do \ |
155 |
|
156 |
if test "$FILE" != "$FCRONTABS/*"; then |
157 |
|
158 |
BASENAME=`basename $FILE` ; \ |
159 |
FCRONTAB=`echo "$BASENAME" | \ |
160 |
sed "s|.*orig|| ; s|fcrontab.sig|| ; s|rm.*||"` ; \ |
161 |
( test ! -z "$FCRONTAB" && convert-fcrontab $FCRONTAB ) \ |
162 |
|| echo -n ""; \ |
163 |
|
164 |
fi |
165 |
|
166 |
done |
167 |
|
168 |
fi |
169 |
|
170 |
fi |
171 |
|
172 |
%{_initrddir}/fcron start |
173 |
%_post_service %{name} |
174 |
|
175 |
%postun |
176 |
if [ "$1" = "0" ]; then |
177 |
# Remove user fcron |
178 |
%_postun_userdel fcron |
179 |
fi |
180 |
|
181 |
%preun |
182 |
%_preun_service %{name} |
183 |
|
184 |
%files |
185 |
%doc fcrontab.example |
186 |
%{_initrddir}/fcron |
187 |
%attr(640,root,fcron) %config(noreplace) %{_sysconfdir}/fcron.conf |
188 |
%attr(640,root,fcron) %config(noreplace) %{_sysconfdir}/fcron.allow |
189 |
%attr(640,root,fcron) %config(noreplace) %{_sysconfdir}/fcron.deny |
190 |
%config(noreplace) %{_sysconfdir}/pam.d/fcron |
191 |
%config(noreplace) %{_sysconfdir}/pam.d/fcrontab |
192 |
%{_tmpfilesdir}/%{name}.conf |
193 |
%{_mandir}/man8/fcron.8* |
194 |
%{_mandir}/man1/fcrontab.1* |
195 |
%{_mandir}/man1/fcrondyn.1* |
196 |
%{_mandir}/man1/fcron-update-crontabs.1* |
197 |
%{_mandir}/man5/fcrontab.5* |
198 |
%{_mandir}/man5/fcron.conf.5* |
199 |
%{_mandir}/man3/bitstring.3* |
200 |
%lang(fr) %{_mandir}/fr/man?/* |
201 |
%attr(6111,root,root) %{_bindir}/convert-fcrontab |
202 |
%attr(6111,root,root) %{_bindir}/fcronsighup |
203 |
%attr(6111,root,root) %{_bindir}/fcrondyn |
204 |
%attr(6111,fcron,fcron) %{_bindir}/fcrontab |
205 |
%attr(110,root,root) %{_sbindir}/fcron |
206 |
%{_sbindir}/fcron-update-crontabs |
207 |
%dir %attr(770,fcron,fcron) /var/spool/fcron |