2 # - put imap-ssl and pop3-ssl to separate packages - some want to have
3 # ssl-only system (or non-ssl only system)
4 # see also http://thread.gmane.org/gmane.linux.pld.devel.english/2509/focus=2509
6 # [set $man.base.url.for.relative.links]/maildirquota.html
7 # - Review -toplevel.patch
10 %bcond_with toplevel # Allow toplevel folders. More info: http://www.ricky-chan.co.uk/courier/
11 %bcond_without fam # FAM for enhanced IMAP IDLE and locking
12 %bcond_with gnutls # GnuTLS instead of OpenSSL
13 %bcond_with socks # (Courier) Socks support
15 Summary: Courier-IMAP server
16 Summary(pl.UTF-8): Serwer Courier-IMAP
20 License: GPL v3 with OpenSSL exception
21 Group: Networking/Daemons
22 Source0: https://downloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2
23 # Source0-md5: 7f210160a19ec973ea39d9ef32e25053
25 Source2: %{name}-ssl.init
26 Source3: %{name}-pop3.init
27 Source4: %{name}-pop3-ssl.init
29 Source6: %{name}-pop3.pamd
30 Patch0: %{name}-dirs.patch
31 Patch1: %{name}-certsdir.patch
32 Patch2: %{name}-maildir.patch
33 Patch3: %{name}-toplevel.patch
34 Patch4: %{name}-drop-makedat.patch
35 Patch5: %{name}-disable-courierlogger-check.patch
36 URL: http://www.courier-mta.org/imap/
37 BuildRequires: autoconf >= 2.59
38 BuildRequires: automake
39 BuildRequires: courier-authlib-devel >= 0.71.0
40 %{?with_socks:BuildRequires: courier-sox-devel}
41 BuildRequires: courier-unicode-devel >= 2.1
42 BuildRequires: db-devel
43 BuildRequires: libidn2-devel >= 0.0.0
44 %{?with_fam:BuildRequires: gamin-devel}
45 %{?with_gnutls:BuildRequires: gnutls-devel >= 3.0}
46 %{?with_gnutls:BuildRequires: libgcrypt-devel}
47 %{?with_gnutls:BuildRequires: libgpg-error-devel}
48 BuildRequires: libstdc++-devel
49 BuildRequires: libtool >= 2:2
50 %{!?with_gnutls:BuildRequires: openssl-devel >= 0.9.7d}
51 BuildRequires: perl-base
52 BuildRequires: pkgconfig
54 BuildRequires: rpmbuild(macros) >= 1.268
55 BuildRequires: sed >= 4.0
56 BuildRequires: sysconftool
57 Requires(post,preun): /sbin/chkconfig
58 Requires: %{name}-common = %{version}-%{release}
59 Requires: /sbin/chkconfig
60 Requires: courier-unicode >= 2.1
61 Requires: pam >= 0.79.0
65 Conflicts: cyrus-imapd
67 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
69 %define _sysconfdir /etc/courier-imap
70 %define _certsdir %{_sysconfdir}/certs
71 %define _localstatedir /var/spool/courier-imap
74 Courier-IMAP is an IMAP server for Maildir mailboxes.
76 %description -l pl.UTF-8
77 Courier-IMAP jest serwerem IMAP dla skrzynek pocztowych Maildir.
80 Summary: Common files for imap and pop3 daemons
81 Summary(pl.UTF-8): Pliki wspólne dla serwerów imap i pop3
82 Group: Networking/Daemons
83 Requires(post,preun): /sbin/chkconfig
84 Requires: /sbin/chkconfig
85 # even if using OpenSSL libraries, Courier uses certtool from GnuTLS
86 Requires: /usr/bin/certtool
87 Requires: courier-authlib >= 0.71.0
90 Conflicts: maildrop < 3
93 Common files for imap and pop3 daemons.
95 %description common -l pl.UTF-8
96 Pliki wspólne dla serwerów imap i pop3.
99 Summary: Deliver to a Maildir with a quota
100 Summary(pl.UTF-8): Obsługa quoty przy dostarczaniu poczty do skrzynek Maildir
101 Group: Networking/Daemons
103 %description deliverquota
104 deliverquota is a temporary hack to implement E-mail delivery to a
105 Maildir with a software-imposed quota.
107 %description deliverquota -l pl.UTF-8
108 deliverquota jest tymczasowym rozwiązaniem implementującym
109 dostarczanie e-maili do skrzynek Maildir z programowo narzuconą quotą.
112 Summary: Tool for making mail folders in Maildir format
113 Summary(pl.UTF-8): Narzędzie do tworzenia folderów w formacie Maildir
114 Group: Networking/Daemons
115 Conflicts: qmail-maildirmake
117 %description maildirmake
118 Maildirmake is a tool for making mail folders in Maildir format.
120 %description maildirmake -l pl.UTF-8
121 Maildirmake jest narzędziem do tworzenia folderów pocztowych w
125 Summary: Courier-IMAP POP3 Server
126 Summary(pl.UTF-8): Serwer Courier-IMAP POP3
127 Group: Networking/Daemons/POP3
128 Requires: %{name}-common = %{version}-%{release}
129 Requires: pam >= 0.79.0
131 Obsoletes: pop3daemon
132 Conflicts: cyrus-imapd
134 Conflicts: solid-pop3d
138 Courier-IMAP POP3 is an POP3 server for Maildir mailboxes.
140 %description pop3 -l pl.UTF-8
141 Courier-IMAP POP3 jest serwerem POP3 dla skrzynek pocztowych Maildir.
154 cp -p %{SOURCE1} courier-imap.in
155 cp -p %{SOURCE2} courier-imap-ssl.in
156 cp -p %{SOURCE3} courier-pop3.in
157 cp -p %{SOURCE4} courier-pop3-ssl.in
161 # Change Makefile.am files and force recreate Makefile.in's.
162 find -type f -a -name configure.ac | while read FILE; do
163 cd "$(dirname "$FILE")"
165 %{__sed} -i -e '/_[L]DFLAGS=-static/d' Makefile.am
169 if grep -q AC_CONFIG_HEADER configure.ac; then
178 CERTOOL=/usr/bin/certtool \
180 ac_cv_header_fam_h=no \
181 ac_cv_lib_fam_FAMOpen=no \
183 --libexecdir=%{_libexecdir}/courier-imap \
185 --with-authchangepwdir=/var/tmp \
186 --with-certsdir=%{_certsdir} \
188 %{?with_gnutls:--with-gnutls} \
189 --with-mailer=/usr/lib/sendmail \
190 --with-notice=unicode \
191 %{!?with_socks:--without-socks}
196 rm -rf $RPM_BUILD_ROOT
197 install -d $RPM_BUILD_ROOT{/etc/{pam.d,rc.d/init.d,security},%{_certsdir}}
199 %{__make} -j1 install \
200 DESTDIR=$RPM_BUILD_ROOT
202 install -p courier-imap $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap
203 install -p courier-imap-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap-ssl
204 install -p courier-pop3 $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3
205 install -p courier-pop3-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3-ssl
206 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/imap
207 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/pop3
209 # install directly instead of symlinking
210 %{__rm} $RPM_BUILD_ROOT%{_sbindir}/mk{dhparams,imapdcert,pop3dcert}
211 %{__mv} $RPM_BUILD_ROOT%{_datadir}/mk{dhparams,imapdcert,pop3dcert} $RPM_BUILD_ROOT%{_sbindir}
213 # missing from make install
214 cp -p libs/imap/courierpop3d.8 $RPM_BUILD_ROOT%{_mandir}/man8
215 cp -p libs/tcpd/couriertls.1 $RPM_BUILD_ROOT%{_mandir}/man1
217 touch $RPM_BUILD_ROOT/etc/security/blacklist.{pop3,imap}
218 touch $RPM_BUILD_ROOT%{_sysconfdir}/shared/index
221 ./sysconftool $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
223 # set yes to start imapd and pop3d
224 sed -i 's/^POP3DSTART.*/POP3DSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/pop3d
225 sed -i 's/^IMAPDSTART.*/IMAPDSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/imapd
227 # remove unpackaged files
228 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
231 rm -rf $RPM_BUILD_ROOT
234 /sbin/chkconfig --add courier-imap
235 /sbin/chkconfig --add courier-imap-ssl
236 %service courier-imap restart "courier-imap daemon"
237 %service courier-imap-ssl restart "courier-imap-ssl daemon"
240 if [ "$1" = "0" ]; then
241 %service courier-imap stop
242 /sbin/chkconfig --del courier-imap
245 if [ "$1" = "0" ]; then
246 %service courier-imap-ssl stop
247 /sbin/chkconfig --del courier-imap-ssl
251 %triggerin -- %{name} < 3.0.6
253 if [ -f /var/lib/openssl/certs/imapd.pem ]; then
255 echo imapd.pem has been moved automatically to %{_certsdir}
257 mv -f /var/lib/openssl/certs/imapd.pem %{_certsdir}
259 if [ -f /etc/sysconfig/courier-imap ]; then
260 . /etc/sysconfig/courier-imap
261 for opt in `grep ^[^#] /etc/sysconfig/courier-imap |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
264 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd
265 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd-ssl
267 sed -i s/^SSLADDRESS=.*/"SSLADDRESS=$ADDRESS_SSL"/ %{_sysconfdir}/imapd-ssl
268 sed -i s/^SSLPORT=.*/"SSLPORT=$PORTS_SSL"/ %{_sysconfdir}/imapd-ssl
269 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd-ssl
270 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd
272 echo IMAPD config file has been rewriten to %{_sysconfdir}/imapd,imapd-ssl
273 echo please look at them
276 %service -q courier-imap restart
279 . %{_sysconfdir}/imapd-ssl
280 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
281 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/imapd-ssl
284 %triggerin -n %{name}-common -- %{name}-userdb
286 echo courier-imap-userdb is obsolete
287 echo install courier-authlib-userdb package
290 %triggerin -n %{name}-common -- %{name}-common < 3.0.5
291 /sbin/chkconfig --del authdaemon
292 if [ -f /var/lock/subsys/authdaemon ]; then
293 kill `cat /var/lib/authdaemon/pid`
294 rm -f /var/lock/subsys/authdaemon
296 if [ -f /etc/sysconfig/authdaemon ]; then
297 . /etc/sysconfig/authdaemon
298 sed -i s/^version.*/version=authdaemond.$METHOD/ %{_sysconfdir}/authdaemonrc
301 echo Changes to version 3.0.5 :
302 echo - config files has been split and moved to %{_sysconfdir}
303 echo - certificates directory has changed to %{_certsdir}
306 %triggerpostun common -- %{name}-common < 5
307 %banner -e courier-imap-unicode <<EOF
308 WARNING: you have to convert any existing maildirs to Unicode naming scheme.
309 See INSTALL file for details.
313 /sbin/chkconfig --add courier-pop3
314 /sbin/chkconfig --add courier-pop3-ssl
315 /sbin/chkconfig --del courier-imap-pop3 >/dev/null 2>&1 || :
316 if [ -f /var/lock/subsys/courier-imap-pop3 ]; then
317 /sbin/service courier-imap-pop3 stop >&2
318 /sbin/service courier-pop3 start >&2
320 %service courier-pop3 restart "courier-pop3 daemon"
322 %service courier-pop3-ssl restart "courier-pop3-ssl daemon"
325 if [ "$1" = "0" ]; then
326 %service courier-pop3 stop
327 /sbin/chkconfig --del courier-pop3
328 %service courier-pop3-ssl stop
329 /sbin/chkconfig --del courier-pop3-ssl
332 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.6
334 if [ -f /var/lib/openssl/certs/pop3d.pem ]; then
336 echo pop3d.pem has been moved automatically to %{_certsdir}
338 mv -f /var/lib/openssl/certs/pop3d.pem %{_certsdir}
340 if [ -f /etc/sysconfig/courier-pop3 ]; then
341 . /etc/sysconfig/courier-pop3
342 for opt in `grep ^[^#] /etc/sysconfig/courier-pop3 |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
345 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d
346 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d-ssl
348 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d-ssl
349 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d
351 echo POP3D config file has been rewriten to %{_sysconfdir}/{pop3d,pop3d-ssl}
352 echo please look at them
355 %service courier-pop3 restart
358 . %{_sysconfdir}/pop3d-ssl
359 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
360 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/pop3d-ssl
364 %defattr(644,root,root,755)
365 %doc libs/maildir/README.sharedfolders.txt libs/imap/README.proxy libs/tcpd/README.couriertls
366 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/imap
367 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.imap
368 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd
369 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd-ssl
370 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd.cnf
371 %attr(754,root,root) /etc/rc.d/init.d/courier-imap
372 %attr(754,root,root) /etc/rc.d/init.d/courier-imap-ssl
373 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared
374 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared.tmp
375 %attr(644,daemon,daemon) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/shared/index
376 %attr(755,root,root) %{_bindir}/imapd
377 %attr(755,root,root) %{_bindir}/maildiracl
378 %attr(755,root,root) %{_bindir}/maildirkw
379 %attr(755,root,root) %{_bindir}/makeimapaccess
380 %attr(755,root,root) %{_sbindir}/imaplogin
381 %attr(755,root,root) %{_sbindir}/mkimapdcert
382 %attr(755,root,root) %{_sbindir}/sharedindexinstall
383 %attr(755,root,root) %{_sbindir}/sharedindexsplit
384 %attr(755,root,root) %{_libexecdir}/courier-imap/imapd.rc
385 %attr(755,root,root) %{_libexecdir}/courier-imap/imapd-ssl.rc
386 %{_mandir}/man1/maildiracl.1*
387 %{_mandir}/man1/maildirkw.1*
388 %{_mandir}/man8/imapd.8*
389 %{_mandir}/man8/makeimapaccess.8*
390 %{_mandir}/man8/mkimapdcert.8*
393 %defattr(644,root,root,755)
394 %doc AUTHORS COPYING INSTALL NEWS README libs/imap/{BUGS,ChangeLog} libs/maildir/README.maildirquota.txt
395 %attr(751,root,root) %dir %{_sysconfdir}
396 %attr(750,root,root) %dir %{_certsdir}
397 %attr(770,daemon,daemon) %dir %{_localstatedir}
398 %dir %{_libexecdir}/courier-imap
399 %{_sysconfdir}/quotawarnmsg.example
400 %attr(755,root,root) %{_bindir}/couriertls
401 %attr(755,root,root) %{_sbindir}/mkdhparams
402 %attr(755,root,root) %{_libexecdir}/courier-imap/couriertcpd
403 %{_mandir}/man1/couriertcpd.1*
404 %{_mandir}/man1/couriertls.1*
405 %{_mandir}/man8/mkdhparams.8*
408 %defattr(644,root,root,755)
409 %attr(755,root,root) %{_bindir}/deliverquota
410 %{_mandir}/man8/deliverquota.8*
413 %defattr(644,root,root,755)
414 %attr(755,root,root) %{_bindir}/maildirmake
415 %{_mandir}/man1/maildirmake.1*
418 %defattr(644,root,root,755)
419 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/pop3
420 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.pop3
421 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d
422 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d-ssl
423 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d.cnf
424 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3
425 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3-ssl
426 %attr(755,root,root) %{_bindir}/pop3d
427 %attr(755,root,root) %{_sbindir}/mkpop3dcert
428 %attr(755,root,root) %{_sbindir}/pop3login
429 %attr(755,root,root) %{_libexecdir}/courier-imap/pop3d.rc
430 %attr(755,root,root) %{_libexecdir}/courier-imap/pop3d-ssl.rc
431 %{_mandir}/man8/courierpop3d.8*
432 %{_mandir}/man8/mkpop3dcert.8*