1 |
# use saslauth group if |
2 |
%define SASLGROUP 0 |
3 |
%{?_with_saslgroup: %{expand: %%define SASLGROUP 1}} |
4 |
|
5 |
# preforking cyrus.conf as default |
6 |
%define PREFORK 1 |
7 |
%{?_without_prefork: %{expand: %%define PREFORK 0}} |
8 |
|
9 |
# enable idled (default no) |
10 |
%define IDLED 0 |
11 |
%{?_with_idled: %{expand: %%define IDLED 1}} |
12 |
|
13 |
# enable automatic mailbox creation on deliver (default no): |
14 |
%define build_autocreate 1 |
15 |
%{?_without_autocreate: %define build_autocreate 0} |
16 |
|
17 |
# create on demand folder requested by sieve filter (default no): |
18 |
%define build_autosieve 1 |
19 |
%{?_without_autosieve: %define build_autosieve 0} |
20 |
|
21 |
# remove quota files extension: |
22 |
%define build_rmquota 1 |
23 |
%{?_without_rmquota: %define build_rmquota 0} |
24 |
|
25 |
# snmp support |
26 |
%global with_snmp 1 |
27 |
%{?_without_snmp: %global with_snmp 0} |
28 |
|
29 |
# ldap/pts support |
30 |
%global with_ldap 1 |
31 |
%{?_without_ldap: %global with_ldap 0} |
32 |
|
33 |
%global with_mysql 1 |
34 |
%{?_without_mysql: %global with_mysql 0} |
35 |
|
36 |
%global with_pgsql 1 |
37 |
%{?_without_pgsql: %global with_pgsql 0} |
38 |
|
39 |
%global with_sqlite 1 |
40 |
%{?_without_sqlite: %global with_sqlite 0} |
41 |
|
42 |
# virtual domains in LDAP support |
43 |
# needed by Kolab2 |
44 |
%define build_virtualdomains_in_ldap 1 |
45 |
%{?_without_virtualdomains_in_ldap: %define build_virtualdomains_in_ldap 0} |
46 |
|
47 |
%define db4_version 4.8 |
48 |
|
49 |
Summary: A high-performance mail store with IMAP and POP3 support |
50 |
Name: cyrus-imapd |
51 |
Version: 2.4.13 |
52 |
Release: %mkrel 1 |
53 |
License: OSI Approved |
54 |
Group: System/Servers |
55 |
URL: http://asg.web.cmu.edu/cyrus/imapd/ |
56 |
Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/%{name}-%{version}.tar.gz |
57 |
Source1: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/%{name}-%{version}.tar.gz.sig |
58 |
Source2: cyrus-procmailrc |
59 |
Source4: cyrus-user-procmailrc.template |
60 |
Source6: cyrus-imapd.imap-2.1.x-conf |
61 |
Source7: cyrus-imapd.pamd-0.77 |
62 |
Source8: cyrus-imapd.pamd |
63 |
Source11: cyrus-imapd.init |
64 |
Source12: cyrus-imapd.sysconfig |
65 |
Source13: http://clement.hermann.free.fr/scripts/Cyrus/imapcreate.pl |
66 |
Source14: cyrus-imapd.README.RPM |
67 |
Source15: cyrus-imapd.cvt_cyrusdb_all |
68 |
Source19: cyrus-imapd-procmail+cyrus.mc |
69 |
Source20: cyrus-imapd.cron-daily |
70 |
Source21: http://ftp.andrew.cmu.edu/pub/net/mibs/cmu/cmu.mib |
71 |
# This patch fixes the perl install path for mdk9.0 and later |
72 |
Patch1: cyrus-imapd-mdk9.0perl-patch |
73 |
# cyrus-master instead of master in syslog |
74 |
Patch2: cyrus-imapd-logident.patch |
75 |
# Autocreate INBOX patch (http://email.uoa.gr/projects/cyrus/autocreate/) |
76 |
Patch3: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.16/cyrus-imapd-2.3.16-autocreate-0.10-0.diff |
77 |
# Create on demand folder requested by sieve filter (http://email.uoa.gr/projects/cyrus/autosievefolder/) |
78 |
Patch4: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.16/cyrus-imapd-2.3.16-autosieve-0.6.0.diff |
79 |
# Remove QUOTA patch (http://email.uoa.gr/projects/cyrus/quota-patches/rmquota/) |
80 |
Patch5: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.9/cyrus-imapd-2.3.9-rmquota-0.5-0.diff |
81 |
# command line switch to disallow plaintext login |
82 |
Patch6: cyrus-imapd-plaintext.diff |
83 |
# 64-bit fixes |
84 |
Patch7: cyrus-imapd-2.2.8-64bit-fixes.patch |
85 |
# (oe) for kolab2: Patch to support virtdomains: ldap (parse domain from "email" field an LDAP user entry) |
86 |
Patch8: cyrus-imapd-kolab-ldap.diff |
87 |
# (oe) for kolab2: Allow for custom annotation |
88 |
Patch9: cyrus-imapd-cyradm_annotate.diff |
89 |
# (bluca) add ptloader to cyrus.conf |
90 |
Patch10: cyrus-imapd-ptloader-conf.diff |
91 |
# (bluca) fix LDAP_OPT_X_SASL_SECPROPS error in ptloader |
92 |
Patch11: cyrus-imapd-ptloader-secprops.diff |
93 |
# http://wiki.mandriva.com/en/Development/Packaging/Problems#format_not_a_string_literal_and_no_format_arguments |
94 |
Patch12: cyrus-imapd-2.3.14-format_not_a_string_literal_and_no_format_arguments.diff |
95 |
# remove verbosity of some syslog messages (simon matter) |
96 |
Patch13: cyrus-imapd-2.1.16-getrlimit.patch |
97 |
Patch14: cyrus-imapd-2.3.12-skiplist_verbosity.patch |
98 |
Patch15: cyrus-imapd-2.3.12-statuscache_verbosity.patch |
99 |
Patch16: cyrus-imapd-2.3.16-user_deny_verbosity.patch |
100 |
# Other patches from simon matter |
101 |
Patch17: cyrus-imapd-2.3.7-mancyrusdb.patch |
102 |
Patch18: cyrus-imapd-2.3.13-make_md5_sha1_dirs.patch |
103 |
Patch19: cyrus-imapd-2.3.11-mkimap.patch |
104 |
Patch20: cyrus-imapd-2.3.16-sync_client_tls_capability_response.patch |
105 |
Patch21: cyrus-imapd-2.3.16-sieve_port.patch |
106 |
# make it build with perl 5.14 |
107 |
Patch22: cyrus-imapd-2.3.16-perl514.patch |
108 |
|
109 |
Requires: perl |
110 |
# with previous versions of sasl, imap LOGIN would fail |
111 |
Requires: %{mklibname sasl 2} >= 2.1.15 |
112 |
#Requires: krb5-libs |
113 |
Requires(pre): /usr/sbin/useradd |
114 |
Requires(pre): rpm-helper |
115 |
%if %{SASLGROUP} |
116 |
Requires(pre): /usr/sbin/groupadd |
117 |
%endif |
118 |
Requires(post): chkconfig /usr/bin/openssl /usr/bin/chattr /bin/grep /bin/cp perl |
119 |
Requires(preun):/sbin/service chkconfig /usr/sbin/userdel /bin/rm |
120 |
%if %{SASLGROUP} |
121 |
Requires(preun):/usr/sbin/groupdel |
122 |
%endif |
123 |
Requires(postun):/sbin/service |
124 |
Provides: imap |
125 |
Provides: imap-server |
126 |
BuildRequires: autoconf |
127 |
BuildRequires: libsasl-devel >= 2.1.15 |
128 |
#BuildRequires: e2fsprogs-devel |
129 |
BuildRequires: perl-devel |
130 |
BuildRequires: tcp_wrappers-devel |
131 |
#BuildRequires: db4-devel >= %{db4_version} |
132 |
BuildRequires: openssl-devel |
133 |
BuildRequires: flex |
134 |
BuildRequires: bison |
135 |
BuildRequires: groff >= 1.15-8 |
136 |
%if %{with_snmp} |
137 |
BuildRequires: net-snmp-devel >= 5.1 |
138 |
BuildRequires: libelfutils-devel |
139 |
Requires: net-snmp-mibs |
140 |
%endif |
141 |
%if %{with_ldap} |
142 |
BuildRequires: openldap-devel |
143 |
%else |
144 |
%if %{build_virtualdomains_in_ldap} |
145 |
BuildRequires: openldap-devel |
146 |
%endif |
147 |
%endif |
148 |
%if %{with_mysql} |
149 |
BuildRequires: mysql-devel |
150 |
%endif |
151 |
%if %{with_pgsql} |
152 |
BuildRequires: postgresql-devel |
153 |
%endif |
154 |
%if %{with_sqlite} |
155 |
BuildRequires: sqlite3-devel |
156 |
%endif |
157 |
|
158 |
%if %{SASLGROUP} |
159 |
%define _saslgroup saslauth |
160 |
%endif |
161 |
%define _cyrususer cyrus |
162 |
%define _cyrusgroup mail |
163 |
%define _vardata %{_var}/lib/imap |
164 |
%define _spooldata %{_var}/spool/imap |
165 |
# (gb) stick to /usr/lib/cyrus-imapd as this is an existing practise |
166 |
# from MDK 10.0 and below + /etc/init.d/cyrus-imapd would need to |
167 |
# runtime-detect the libdir since this ought to be an arch-independent |
168 |
# script. |
169 |
%define _cyrexecdir %{_prefix}/lib/cyrus-imapd |
170 |
%define _confdir master/conf |
171 |
%if %{PREFORK} |
172 |
%define _cyrusconf %{_confdir}/prefork.conf |
173 |
%else |
174 |
%define _cyrusconf %{_confdir}/normal.conf |
175 |
%endif |
176 |
|
177 |
%description |
178 |
The Cyrus IMAP Server is a scaleable enterprise mail system |
179 |
designed for use from small to large enterprise environments using |
180 |
standards-based technologies. |
181 |
|
182 |
A full Cyrus IMAP implementation allows a seamless mail and bulletin |
183 |
board environment to be set up across multiple servers. It differs from |
184 |
other IMAP server implementations in that it is run on "sealed" |
185 |
servers, where users are not normally permitted to log in. The mailbox |
186 |
database is stored in parts of the filesystem that are private to the |
187 |
Cyrus IMAP system. All user access to mail is through software using |
188 |
the IMAP, POP3, or KPOP protocols. TLSv1 and SSL are supported for |
189 |
security. |
190 |
|
191 |
This is the main package, install also the %{name}-utils package (it |
192 |
contains server administration tools and depends on the perl-Cyrus |
193 |
package). |
194 |
|
195 |
%package murder |
196 |
Summary: Cyrus IMAP server murder aggregator system files |
197 |
Group: System/Servers |
198 |
Requires: %{name} = %{version}-%{release} |
199 |
|
200 |
%description murder |
201 |
The %{name}-murder package contains the Cyrus murder aggregator system, |
202 |
i.e. IMAP, POP3 and LMTP proxies, and the mupdate mailbox master daemon. |
203 |
It allows for cluster setups where there are many backend Cyrus spools |
204 |
and frontend proxy servers. |
205 |
|
206 |
%package nntp |
207 |
Summary: Cyrus IMAP server murder nntp support files |
208 |
Group: System/Servers |
209 |
Requires: %{name} = %{version}-%{release} |
210 |
Conflicts: leafnode |
211 |
|
212 |
%description nntp |
213 |
Cyrus has the ability to export Usenet via IMAP and/or export shared |
214 |
IMAP mailboxes via NNTP. This is made possible by a new NNTP daemon |
215 |
which is included in this package. |
216 |
|
217 |
%package devel |
218 |
Summary: Cyrus IMAPd development files |
219 |
Group: Development/Other |
220 |
|
221 |
%description devel |
222 |
This package contains header files and libraries necessary for |
223 |
developing applications which use the imclient library. |
224 |
|
225 |
The main package is %{name}. |
226 |
|
227 |
%package -n perl-Cyrus |
228 |
Summary: Cyrus IMAPd utility Perl modules |
229 |
Group: Development/Perl |
230 |
# with previous versions of sasl, imap LOGIN would fail |
231 |
Requires: %{mklibname sasl 2} >= 2.1.15 |
232 |
|
233 |
%description -n perl-Cyrus |
234 |
This package contains Perl modules necessary to use the Cyrus server |
235 |
administrative utilities. |
236 |
|
237 |
The main package is %{name}. |
238 |
|
239 |
%package utils |
240 |
Summary: Cyrus IMAPd server admin utilities |
241 |
Group: System/Servers |
242 |
Requires: perl-Cyrus = %{version}-%{release} |
243 |
|
244 |
%description utils |
245 |
This package contains Cyrus IMAPd server administrative tools. It |
246 |
can be installed on systems other than the one running the server. |
247 |
|
248 |
This package depends on the perl-Cyrus package. |
249 |
The main package is %{name}. |
250 |
|
251 |
%prep |
252 |
|
253 |
%setup -q -n %{name}-%{version} |
254 |
%patch1 -b .mdk9.0perl.orig |
255 |
%patch2 |
256 |
# %if %{build_autocreate} |
257 |
# %patch3 -p1 -b .autocreate.orig |
258 |
# %endif |
259 |
#%if %{build_autosieve} |
260 |
# # %patch4 -p1 -b .autosieve.orig |
261 |
# %endif |
262 |
# %if %{build_rmquota} |
263 |
# %patch5 -p1 -b .rmquota.orig |
264 |
# %endif |
265 |
|
266 |
# %patch6 -p1 -b .plaintext.orig |
267 |
# %patch7 -p1 -b .64bit-fixes.orig |
268 |
|
269 |
# (oe) for kolab2: Patch to support virtdomains: ldap (parse domain from "email" field an LDAP user entry) |
270 |
%if %{build_virtualdomains_in_ldap} |
271 |
%patch8 -p1 -b .kolab-ldap.orig |
272 |
%endif |
273 |
# (oe) for kolab2: Allow for custom annotation |
274 |
# %patch9 -p1 -b .annotate.orig |
275 |
# %if %{with_ldap} |
276 |
# %patch10 -p1 -b .ptloader.orig |
277 |
# %endif |
278 |
%patch11 -p1 -b .secprops.orig |
279 |
# %patch12 -p1 -b .format_not_a_string_literal_and_no_format_arguments.orig |
280 |
|
281 |
%patch13 -p1 -b .getrlimit.orig |
282 |
%patch14 -p1 -b .skiplist_verbosity.orig |
283 |
# %patch15 -p1 -b .statuscache_verbosity.orig |
284 |
# %patch16 -p1 -b .user_deny_verbosity.orig |
285 |
|
286 |
# %patch17 -p1 -b .mancyrusdb.orig |
287 |
# %patch18 -p1 -b .make_md5_sha1_dirs.orig |
288 |
%patch19 -p1 -b .mkimap.orig |
289 |
# %patch20 -p1 -b .sync_client_tls_capability_response.orig |
290 |
%patch21 -p1 -b .sieve_port.orig |
291 |
# %patch22 -p1 -b .perl514 |
292 |
|
293 |
## Extra documentation |
294 |
mkdir -p extradocs |
295 |
for i in %{SOURCE2} %{SOURCE4} %{SOURCE19} ; do |
296 |
cp $i extradocs |
297 |
done |
298 |
|
299 |
## remove cvs file |
300 |
rm -f doc/text/.cvsignore |
301 |
|
302 |
## regenerate html man pages |
303 |
pushd man |
304 |
for mp in *[1-8] ; do groff -m man -T html $mp > ../doc/man/$mp.html ; done |
305 |
popd |
306 |
|
307 |
# fix build under mdx8.2 |
308 |
perl -ni -e "print unless /^AC_PREREQ/" configure.in |
309 |
|
310 |
# fix conditional pam config file |
311 |
install -m 0644 %{SOURCE8} cyrus-imapd.pamd |
312 |
|
313 |
# cleanup |
314 |
for i in `find . -type d -name CVS` `find . -type d -name .svn` `find . -type f -name .cvs\*` `find . -type f -name .#\*`; do |
315 |
if [ -e "$i" ]; then rm -rf $i; fi >&/dev/null |
316 |
done |
317 |
|
318 |
%build |
319 |
%serverbuild |
320 |
|
321 |
CPPFLAGS="-I%{_includedir}/et $CPPFLAGS" |
322 |
export CPPFLAGS |
323 |
CFLAGS="$RPM_OPT_FLAGS -fPIC" |
324 |
export CFLAGS |
325 |
LDFLAGS="-L%{_libdir}" |
326 |
export LDFLAGS |
327 |
|
328 |
#with the existing autom4te.cache autoheader would fail with the message |
329 |
#Can't locate object method "path" via package "Request" at /usr/share/autoconf/Autom4te/C4che.pm line 69, <GEN1> line 111. |
330 |
# |
331 |
|
332 |
rm -rf autom4te.cache configure |
333 |
export WANT_AUTOCONF_2_5=1 |
334 |
libtoolize --copy --force; aclocal -I cmulocal; autoheader; autoconf |
335 |
|
336 |
%configure2_5x \ |
337 |
%if %{IDLED} |
338 |
--with-idle=idled \ |
339 |
%endif |
340 |
%if !%{with_snmp} |
341 |
--without-snmp \ |
342 |
%endif |
343 |
%if %{with_ldap} |
344 |
--with-ldap=/usr \ |
345 |
%endif |
346 |
%if %{with_mysql} |
347 |
--with-mysql --with-mysql-incdir=/usr/include/mysql \ |
348 |
%endif |
349 |
%if %{with_pgsql} |
350 |
--with-pgsql \ |
351 |
%endif |
352 |
%if %{with_sqlite} |
353 |
--with-sqlite \ |
354 |
%endif |
355 |
--with-extraident="Mandriva-RPM-%{version}-%{release}" \ |
356 |
--with-syslogfacility=MAIL \ |
357 |
--with-bdb=db-%{db4_version} \ |
358 |
--enable-murder \ |
359 |
--enable-netscapehack \ |
360 |
--enable-listext \ |
361 |
--enable-nntp \ |
362 |
--with-perl=%{__perl} \ |
363 |
--with-cyrus-prefix=%{_cyrexecdir} \ |
364 |
--with-service-path=%{_cyrexecdir} \ |
365 |
# --with-krb=%{_prefix}/kerberos \ |
366 |
|
367 |
make clean |
368 |
# no parallel make - 2.3.10 |
369 |
make |
370 |
|
371 |
# Modify docs master --> cyrus-master |
372 |
pushd man |
373 |
perl -pi -e "s#master\(8\)#cyrus-master(8)#" `ls *5 *8` |
374 |
cd ../doc |
375 |
perl -pi -e "s#master#cyrus-master#g;" man.html |
376 |
cd man |
377 |
perl -pi -e "s#master\(8\)#cyrus-master(8)#;" `ls *html` |
378 |
popd |
379 |
|
380 |
# Modify path in perl scripts |
381 |
pushd perl/imap/examples |
382 |
perl -pi -e "s#/usr/local/bin/perl#%{__perl}#" `find . -type f -name "*.pl"` |
383 |
popd |
384 |
|
385 |
# Cleanup of doc dir |
386 |
find doc perl -name CVS -type d | xargs -r rm -fr |
387 |
find doc -name "*~" -type f | xargs -r rm -f |
388 |
find doc -name "*.*.orig" -type f | xargs -r rm -f |
389 |
|
390 |
rm -f doc/Makefile.dist |
391 |
rm -f doc/text/htmlstrip.c |
392 |
|
393 |
# modify lmtp socket path in .conf files |
394 |
perl -pi -e "s#/var/imap#%{_vardata}#" %{_confdir}/*.conf |
395 |
|
396 |
%install |
397 |
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} |
398 |
|
399 |
%makeinstall_std |
400 |
%makeinstall_std -C man |
401 |
|
402 |
%{__install} -m 755 imtest/imtest %{buildroot}%{_cyrexecdir}/ |
403 |
%{__install} -m 755 perl/imap/cyradm %{buildroot}%{_cyrexecdir}/ |
404 |
|
405 |
# Install tools |
406 |
for tool in dohash masssievec mkimap mknewsgroups rehash translatesieve undohash upgradesieve ; do |
407 |
test -f tools/${tool} && %{__install} -m 755 tools/${tool} %{buildroot}%{_cyrexecdir}/ |
408 |
done |
409 |
%{__install} -m 755 %{SOURCE13} %{buildroot}%{_cyrexecdir}/imapcreate |
410 |
|
411 |
# Create directories |
412 |
%{__install} -d \ |
413 |
%if %{with_snmp} |
414 |
%{buildroot}%{_datadir}/snmp/mibs \ |
415 |
%endif |
416 |
%if %{with_ldap} |
417 |
%{buildroot}%{_vardata}/ptclient/ \ |
418 |
%endif |
419 |
%{buildroot}%{_initrddir} \ |
420 |
%{buildroot}%{_sysconfdir}/{pam.d,sysconfig,cron.daily} \ |
421 |
%{buildroot}%{_libdir}/sasl \ |
422 |
%{buildroot}%{_bindir} \ |
423 |
%{buildroot}%{_spooldata}/stage. \ |
424 |
%{buildroot}%{_vardata}/{user,quota,proc,log,msg,socket,db,sieve,rpm,backup} |
425 |
|
426 |
# Install additional files |
427 |
%{__install} -m 755 %{SOURCE15} %{buildroot}%{_cyrexecdir}/cvt_cyrusdb_all |
428 |
|
429 |
# Install config files |
430 |
%{__install} -m 644 %{_cyrusconf} %{buildroot}%{_sysconfdir}/cyrus.conf |
431 |
%{__install} -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/imapd.conf |
432 |
|
433 |
%{__install} -m 644 cyrus-imapd.pamd %{buildroot}%{_sysconfdir}/pam.d/pop |
434 |
%{__install} -m 644 cyrus-imapd.pamd %{buildroot}%{_sysconfdir}/pam.d/imap |
435 |
%{__install} -m 644 cyrus-imapd.pamd %{buildroot}%{_sysconfdir}/pam.d/sieve |
436 |
%{__install} -m 644 cyrus-imapd.pamd %{buildroot}%{_sysconfdir}/pam.d/mupdate |
437 |
%{__install} -m 644 cyrus-imapd.pamd %{buildroot}%{_sysconfdir}/pam.d/lmtp |
438 |
%{__install} -m 644 cyrus-imapd.pamd %{buildroot}%{_sysconfdir}/pam.d/nntp |
439 |
%{__install} -m 644 cyrus-imapd.pamd %{buildroot}%{_sysconfdir}/pam.d/csync |
440 |
|
441 |
%{__install} -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/%{name} |
442 |
%{__install} -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/%{name} |
443 |
%{__install} -m 755 %{SOURCE20} %{buildroot}%{_sysconfdir}/cron.daily/%{name} |
444 |
|
445 |
%if %{with_snmp} |
446 |
# Install snmp mibs |
447 |
%{__install} -m 644 master/CYRUS-MASTER.mib %{buildroot}%{_datadir}/snmp/mibs/CYRUS-MASTER-MIB.txt |
448 |
%{__install} -m 644 %{SOURCE21} %{buildroot}%{_datadir}/snmp/mibs/CMU-MIB.txt |
449 |
%endif |
450 |
|
451 |
# Install README.RPM |
452 |
%{__install} -m 644 %{SOURCE14} README.RPM |
453 |
cat << EOF >> README.RPM |
454 |
|
455 |
RPM BUILD TIME CONFIGURATION OPTIONS |
456 |
|
457 |
This RPM package has been compiled with the following options: |
458 |
|
459 |
use saslauth group |
460 |
SASLGROUP: %{SASLGROUP} |
461 |
|
462 |
use preforking cyrus.conf |
463 |
PREFORK: %{PREFORK} |
464 |
|
465 |
enable IDLED support |
466 |
IDLED: %{IDLED} |
467 |
|
468 |
enable full directory hash |
469 |
FULLDIRHASH: %{FULLDIRHASH} |
470 |
|
471 |
EOF |
472 |
|
473 |
# Install templates |
474 |
%{__install} -m 755 -d doc/conf |
475 |
%{__install} -m 644 %{_confdir}/*.conf doc/conf/ |
476 |
|
477 |
# Rename 'master' binary and manpage to avoid crash with postfix |
478 |
mv -f %{buildroot}%{_cyrexecdir}/master %{buildroot}%{_cyrexecdir}/cyrus-master |
479 |
mv -f %{buildroot}%{_mandir}/man8/master.8 %{buildroot}%{_mandir}/man8/cyrus-master.8 |
480 |
cp -af doc/man/master.8.html doc/man/cyrus-master.8.html |
481 |
|
482 |
# Create symlinks |
483 |
ln -sf ../lib/cyrus-imapd/cyradm %{buildroot}%{_bindir}/ |
484 |
ln -sf ../lib/cyrus-imapd/imtest %{buildroot}%{_bindir}/ |
485 |
ln -sf ../lib/cyrus-imapd/imapcreate %{buildroot}%{_bindir}/ |
486 |
|
487 |
# required if upgrading from 2.2.x -> 2.3.6+ |
488 |
%{__install} -m 755 tools/migrate-metadata %{buildroot}%{_cyrexecdir}/migrate-metadata |
489 |
|
490 |
# provide the cyrusMaster.conf file, discovered by doing: |
491 |
# /usr/lib/cyrus-imapd/cyrus-master -p /var/run/cyrus-master.pid -D |
492 |
%if %{with_snmp} |
493 |
install -d %{buildroot}/var/lib/net-snmp |
494 |
echo "# placeholder" > %{buildroot}/var/lib/net-snmp/cyrusMaster.conf |
495 |
%endif |
496 |
|
497 |
# cleanup |
498 |
find %{buildroot}%{perl_vendorarch} -name "*.annotate" | xargs rm -f |
499 |
|
500 |
%pre |
501 |
# Create 'cyrus' user on target host |
502 |
%if %{SASLGROUP} |
503 |
/usr/sbin/groupadd -r %{_saslgroup} 2> /dev/null || : |
504 |
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \ |
505 |
-G %{_saslgroup} -s /bin/bash -r %{_cyrususer} 2> /dev/null || : |
506 |
%else |
507 |
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \ |
508 |
-s /bin/bash -r %{_cyrususer} 2> /dev/null || : |
509 |
%endif |
510 |
# move ssl certificate/key from /etc/ssl to /etc/pki/tls |
511 |
if [ -f /etc/ssl/cyrus-imapd/cyrus-imapd.pem -a ! -f /etc/pki/tls/private/cyrus-imapd.pem -a ! -f /etc/pki/tls/certs/cyrus-imapd.pem ];then |
512 |
touch /etc/pki/tls/private/cyrus-imapd.pem |
513 |
chmod 600 /etc/pki/tls/private/cyrus-imapd.pem |
514 |
awk '/^-----BEGIN PRIVATE KEY-----/ {p=1} /-----END PRIVATE KEY-----/ {p=0;print} p == 1 {print}' /etc/ssl/cyrus-imapd/cyrus-imapd.pem > /etc/pki/tls/private/cyrus-imapd.pem |
515 |
awk '/^-----BEGIN PRIVATE KEY-----/ {p=0} /-----END PRIVATE KEY-----/ {p=1;next} p == 1 {print}' /etc/ssl/cyrus-imapd/cyrus-imapd.pem > /etc/pki/tls/certs/cyrus-imapd.pem |
516 |
sed -i -e 's,^[[:space:]]*tls_cert_file:[[:space:]]\+/etc/ssl/cyrus-imapd/cyrus-imapd.pem\>,tls_cert_file: /etc/pki/tls/certs/cyrus-imapd.pem,' /etc/imapd.conf |
517 |
sed -i -e 's,^[[:space:]]*tls_key_file:[[:space:]]\+/etc/ssl/cyrus-imapd/cyrus-imapd.pem\>,tls_key_file: /etc/pki/tls/private/cyrus-imapd.pem,' /etc/imapd.conf |
518 |
rm -f /etc/ssl/cyrus-imapd/cyrus-imapd.pem |
519 |
fi |
520 |
|
521 |
%post |
522 |
if [ $1 = 1 ] ; then |
523 |
# make sure we own the stuff, otherwise /var/log/mail/* will fill |
524 |
# the whole disk with error messages... |
525 |
chown -R %{_cyrususer}:%{_cyrusgroup} %{_vardata} %{_spooldata} |
526 |
fi |
527 |
%_create_ssl_certificate cyrus-imapd |
528 |
chown %{_cyrususer}:%{_cyrusgroup} /etc/pki/tls/private/cyrus-imapd.pem |
529 |
|
530 |
|
531 |
# Force synchronous updates only on ext2 filesystems |
532 |
# Note: This will slow down user creation for 10.000+ users! |
533 |
for i in %{_vardata}/{user,quota} %{_spooldata} |
534 |
do |
535 |
if [ `find $i -maxdepth 0 -printf %F` = "ext2" ]; then |
536 |
chattr -R +S $i 2>/dev/null |
537 |
fi |
538 |
done |
539 |
|
540 |
# Add sieve service if necessary |
541 |
if ! grep -q ^sieve %{_sysconfdir}/services; then |
542 |
echo -e 'sieve\t\t2000/tcp\t\t\t# Sieve mail filter daemon' >> %{_sysconfdir}/services |
543 |
fi |
544 |
|
545 |
# Add lmtp service if necessary |
546 |
if ! grep -q ^lmtp %{_sysconfdir}/services; then |
547 |
echo -e 'lmtp\t\t2003/tcp\t\t\t# Local mail delivery protocol (rfc2033)' >> %{_sysconfdir}/services |
548 |
fi |
549 |
|
550 |
# upgrade from previous versions with compiled in database backends |
551 |
rm -f %{_vardata}/rpm/db.cfg.cache 2> /dev/null |
552 |
|
553 |
# "ctl_deliver -E" is deprecated, now is "cyr_expire -E" |
554 |
if grep -q "ctl_deliver *-E" %{_sysconfdir}/cyrus.conf ; then |
555 |
perl -pi -e "s/ctl_deliver *-E/cyr_expire -E/" %{_sysconfdir}/cyrus.conf |
556 |
fi |
557 |
# compile to byte code sieve scripts on upgrade |
558 |
# masssievec needs to run: |
559 |
# - for versions before 2.2.0 (2.1.x) since they had no bytecode |
560 |
# - upgrading from 2.2.0 since the bytecode has changed |
561 |
# - upgrading from 2.2.1 since the bytecode has changed |
562 |
if [ $1 != 1 ] ; then |
563 |
if [ -f %{_vardata}/rpm/version ] ; then |
564 |
oldversion=`cat %{_vardata}/rpm/version` |
565 |
if [ "$oldversion" = "2.2.0" -o "$oldversion" = "2.2.1" ] ; then |
566 |
compile_needed=1 |
567 |
else |
568 |
compile_needed=0 |
569 |
fi |
570 |
else |
571 |
# versions prior to 2.2.x didn't write the file |
572 |
compile_needed=1 |
573 |
fi |
574 |
if [ $compile_needed = 1 ] ; then |
575 |
echo "compiling sieve scripts" |
576 |
su cyrus -c "%{_cyrexecdir}/masssievec %{_cyrexecdir}/sievec" |
577 |
fi |
578 |
fi |
579 |
# cache the installed version for next upgrade |
580 |
echo %{version} > %{_vardata}/rpm/version |
581 |
|
582 |
%_post_service %{name} |
583 |
|
584 |
%preun |
585 |
%_preun_service %{name} |
586 |
if [ $1 = 0 ]; then |
587 |
/usr/sbin/userdel %{_cyrususer} 2> /dev/null || : |
588 |
%if %{SASLGROUP} |
589 |
if [ "`grep ^%{_saslgroup}: %{_sysconfdir}/group | cut -d: -f4-`" = "" ]; then |
590 |
/usr/sbin/groupdel %{_saslgroup} 2> /dev/null || : |
591 |
fi |
592 |
%endif |
593 |
rm -f %{_vardata}/socket/lmtp 2> /dev/null |
594 |
rm -f %{_vardata}/rpm/version 2> /dev/null |
595 |
fi |
596 |
|
597 |
%triggerin -- %{name} < 2.0.0 |
598 |
#To avoid automatic restart of the daemon when upgrading from versions |
599 |
#1.x.x of Cyrus IMAPd in rpm form, be sure the old daemon is stopped |
600 |
/sbin/service %{name} stop >/dev/null 2>&1 || : |
601 |
|
602 |
%clean |
603 |
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} |
604 |
|
605 |
%files |
606 |
%defattr(-,root,root) |
607 |
%doc doc/* extradocs/* |
608 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/*.conf |
609 |
%attr(0755,root,root) %config(noreplace) %{_initrddir}/%{name} |
610 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name} |
611 |
%attr(0644,root,root) %config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/pop |
612 |
%attr(0644,root,root) %config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/imap |
613 |
%attr(0644,root,root) %config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/sieve |
614 |
%attr(0644,root,root) %config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/lmtp |
615 |
%attr(0755,root,root) %config(noreplace) %{_sysconfdir}/cron.daily/%{name} |
616 |
%attr(0755,root,root) %dir %{_cyrexecdir} |
617 |
%attr(0755,root,root) %{_cyrexecdir}/arbitron |
618 |
%attr(0755,root,root) %{_cyrexecdir}/chk_cyrus |
619 |
%attr(0755,root,root) %{_cyrexecdir}/ctl_cyrusdb |
620 |
%attr(0755,root,root) %{_cyrexecdir}/ctl_deliver |
621 |
%attr(0755,root,root) %{_cyrexecdir}/ctl_mboxlist |
622 |
%attr(0755,root,root) %{_cyrexecdir}/cvt_cyrusdb |
623 |
%attr(0755,root,root) %{_cyrexecdir}/cvt_cyrusdb_all |
624 |
%attr(0755,root,root) %{_cyrexecdir}/cyr_dbtool |
625 |
%attr(0755,root,root) %{_cyrexecdir}/cyr_df |
626 |
%attr(0755,root,root) %{_cyrexecdir}/cyrdump |
627 |
%attr(0755,root,root) %{_cyrexecdir}/cyr_expire |
628 |
%attr(0755,root,root) %{_cyrexecdir}/cyr_synclog |
629 |
%attr(0755,root,root) %{_cyrexecdir}/cyr_sequence |
630 |
%attr(0755,root,root) %{_cyrexecdir}/cyr_userseen |
631 |
%attr(0755,root,root) %{_cyrexecdir}/cyrus-master |
632 |
%attr(0755,root,root) %{_cyrexecdir}/dohash |
633 |
%attr(0755,root,root) %{_cyrexecdir}/fud |
634 |
%attr(0755,root,root) %{_cyrexecdir}/imapd |
635 |
%attr(0755,root,root) %{_cyrexecdir}/ipurge |
636 |
%attr(0755,root,root) %{_cyrexecdir}/lmtpd |
637 |
%attr(0755,root,root) %{_cyrexecdir}/masssievec |
638 |
%attr(0755,root,root) %{_cyrexecdir}/mbexamine |
639 |
%attr(0755,root,root) %{_cyrexecdir}/mbpath |
640 |
%attr(0755,root,root) %{_cyrexecdir}/migrate-metadata |
641 |
%attr(0755,root,root) %{_cyrexecdir}/mkimap |
642 |
%attr(0755,root,root) %{_cyrexecdir}/mknewsgroups |
643 |
%attr(0755,root,root) %{_cyrexecdir}/notifyd |
644 |
%attr(0755,root,root) %{_cyrexecdir}/pop3d |
645 |
%attr(0755,root,root) %{_cyrexecdir}/quota |
646 |
%attr(0755,root,root) %{_cyrexecdir}/reconstruct |
647 |
%attr(0755,root,root) %{_cyrexecdir}/rehash |
648 |
%attr(0755,root,root) %{_cyrexecdir}/sievec |
649 |
%attr(0755,root,root) %{_cyrexecdir}/sieved |
650 |
%attr(0755,root,root) %{_cyrexecdir}/squatter |
651 |
%attr(0755,root,root) %{_cyrexecdir}/timsieved |
652 |
%attr(0755,root,root) %{_cyrexecdir}/tls_prune |
653 |
%attr(0755,root,root) %{_cyrexecdir}/translatesieve |
654 |
%attr(0755,root,root) %{_cyrexecdir}/undohash |
655 |
%attr(0755,root,root) %{_cyrexecdir}/unexpunge |
656 |
%attr(0755,root,root) %{_cyrexecdir}/upgradesieve |
657 |
%if %{with_ldap} |
658 |
%attr(0755,root,root) %{_cyrexecdir}/ptdump |
659 |
%attr(0755,root,root) %{_cyrexecdir}/ptexpire |
660 |
%attr(0755,root,root) %{_cyrexecdir}/ptloader |
661 |
%endif |
662 |
%if %build_autocreate |
663 |
# %attr(0755,root,root) %{_cyrexecdir}/compile_sieve |
664 |
%endif |
665 |
%attr(0755,root,root) %{_cyrexecdir}/smmapd |
666 |
%if %{IDLED} |
667 |
%attr(0755,root,root) %{_cyrexecdir}/idled |
668 |
%endif |
669 |
%attr(4754,%{_cyrususer},%{_cyrusgroup}) %{_cyrexecdir}/deliver |
670 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata} |
671 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/user |
672 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/quota |
673 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/proc |
674 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/log |
675 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/msg |
676 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/socket |
677 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/db |
678 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/sieve |
679 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/rpm |
680 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/backup |
681 |
%if %{with_ldap} |
682 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_vardata}/ptclient |
683 |
%endif |
684 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %dir %{_spooldata} |
685 |
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_spooldata}/* |
686 |
%if %{with_snmp} |
687 |
%attr(0644,root,root) %{_datadir}/snmp/mibs/* |
688 |
%attr(0644,%{_cyrususer},%{_cyrusgroup}) /var/lib/net-snmp/cyrusMaster.conf |
689 |
%endif |
690 |
%attr(0644,root,root) %{_mandir}/man5/* |
691 |
%attr(0644,root,root) %{_mandir}/man8/arbitron.8* |
692 |
%attr(0644,root,root) %{_mandir}/man8/chk_cyrus.8* |
693 |
%attr(0644,root,root) %{_mandir}/man8/ctl_cyrusdb.8* |
694 |
%attr(0644,root,root) %{_mandir}/man8/ctl_deliver.8* |
695 |
%attr(0644,root,root) %{_mandir}/man8/ctl_mboxlist.8* |
696 |
%attr(0644,root,root) %{_mandir}/man8/cvt_cyrusdb.8* |
697 |
%attr(0644,root,root) %{_mandir}/man8/cyr_dbtool.8* |
698 |
%attr(0644,root,root) %{_mandir}/man8/cyr_df.8* |
699 |
%attr(0644,root,root) %{_mandir}/man8/cyr_expire.8* |
700 |
%attr(0644,root,root) %{_mandir}/man8/cyr_synclog.8* |
701 |
%attr(0644,root,root) %{_mandir}/man8/cyrus-master.8* |
702 |
%attr(0644,root,root) %{_mandir}/man8/deliver.8* |
703 |
%attr(0644,root,root) %{_mandir}/man8/fud.8* |
704 |
%attr(0644,root,root) %{_mandir}/man8/idled.8* |
705 |
%attr(0644,root,root) %{_mandir}/man8/imapd.8* |
706 |
%attr(0644,root,root) %{_mandir}/man8/ipurge.8* |
707 |
%attr(0644,root,root) %{_mandir}/man8/lmtpd.8* |
708 |
# %attr(0644,root,root) %{_mandir}/man8/make_md5.8* |
709 |
# %attr(0644,root,root) %{_mandir}/man8/make_sha1.8* |
710 |
%attr(0644,root,root) %{_mandir}/man8/mbexamine.8* |
711 |
%attr(0644,root,root) %{_mandir}/man8/mbpath.8* |
712 |
%attr(0644,root,root) %{_mandir}/man8/notifyd.8* |
713 |
%attr(0644,root,root) %{_mandir}/man8/pop3d.8* |
714 |
%attr(0644,root,root) %{_mandir}/man8/quota.8* |
715 |
%attr(0644,root,root) %{_mandir}/man8/reconstruct.8* |
716 |
%attr(0644,root,root) %{_mandir}/man8/rmnews.8* |
717 |
%attr(0644,root,root) %{_mandir}/man8/smmapd.8* |
718 |
%attr(0644,root,root) %{_mandir}/man8/squatter.8* |
719 |
%attr(0644,root,root) %{_mandir}/man8/sync_client.8* |
720 |
%attr(0644,root,root) %{_mandir}/man8/syncnews.8* |
721 |
%attr(0644,root,root) %{_mandir}/man8/sync_reset.8* |
722 |
%attr(0644,root,root) %{_mandir}/man8/sync_server.8* |
723 |
%attr(0644,root,root) %{_mandir}/man8/timsieved.8* |
724 |
%attr(0644,root,root) %{_mandir}/man8/tls_prune.8* |
725 |
%attr(0644,root,root) %{_mandir}/man8/unexpunge.8* |
726 |
%doc COPYRIGHT README README.RPM |
727 |
%if %{build_autocreate} |
728 |
# %doc README.autocreate |
729 |
%endif |
730 |
|
731 |
%files murder |
732 |
%defattr(-,root,root) |
733 |
%doc doc/text/install-murder |
734 |
%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/mupdate |
735 |
%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/csync |
736 |
%attr(0755,root,root) %{_cyrexecdir}/lmtpproxyd |
737 |
%attr(0755,root,root) %{_cyrexecdir}/mupdate |
738 |
%attr(0755,root,root) %{_cyrexecdir}/pop3proxyd |
739 |
%attr(0755,root,root) %{_cyrexecdir}/proxyd |
740 |
|
741 |
%files nntp |
742 |
%defattr(-,root,root) |
743 |
%doc doc/text/install-netnews |
744 |
%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/nntp |
745 |
%attr(0755,root,root) %{_cyrexecdir}/fetchnews |
746 |
%attr(0755,root,root) %{_cyrexecdir}/nntpd |
747 |
%attr(0644,root,root) %{_mandir}/man8/nntpd.8* |
748 |
%attr(0644,root,root) %{_mandir}/man8/fetchnews.8* |
749 |
|
750 |
%files devel |
751 |
%defattr(-,root,root) |
752 |
%{_includedir}/cyrus |
753 |
%{_libdir}/lib*.a |
754 |
%attr(0644,root,root) %{_mandir}/man3/imclient.3* |
755 |
|
756 |
%files -n perl-Cyrus |
757 |
%defattr(-,root,root) |
758 |
%doc perl/imap/README perl/imap/Changes perl/imap/examples |
759 |
%{perl_vendorarch}/auto/Cyrus |
760 |
%{perl_vendorarch}/Cyrus |
761 |
%attr(0644,root,root) %{_mandir}/man3/Cyrus* |
762 |
|
763 |
%files utils |
764 |
%defattr(-,root,root) |
765 |
%attr(0755,root,root) %{_cyrexecdir}/cyradm |
766 |
%attr(0755,root,root) %{_cyrexecdir}/imtest |
767 |
%attr(0755,root,root) %{_cyrexecdir}/imapcreate |
768 |
%attr(0755,root,root) %{_bindir}/* |
769 |
%attr(0644,root,root) %{_mandir}/man1/* |
770 |
|
771 |
|