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