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 %bcond_with toplevel # Allow toplevel folders. More info: http://www.ricky-chan.co.uk/courier/
8 Summary: Courier-IMAP server
9 Summary(pl.UTF-8): Serwer Courier-IMAP
14 Group: Networking/Daemons
15 Source0: http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
16 # Source0-md5: 8737fb1b55242c20a78fd2d179707311
18 Source2: %{name}-ssl.init
19 Source3: %{name}-pop3.init
20 Source4: %{name}-pop3-ssl.init
22 Source6: %{name}-pop3.pamd
23 Patch0: %{name}-dirs.patch
24 Patch1: %{name}-certsdir.patch
25 Patch2: %{name}-maildir.patch
26 Patch3: %{name}-toplevel.patch
27 Patch4: %{name}-drop-makedat.patch
28 URL: http://www.courier-mta.org/imap/
29 BuildRequires: autoconf >= 2.54
30 BuildRequires: automake
31 BuildRequires: courier-authlib-devel >= 0.61
32 BuildRequires: db-devel
33 BuildRequires: libstdc++-devel
34 BuildRequires: libtool
35 BuildRequires: openssl-devel >= 0.9.7d
37 BuildRequires: rpmbuild(macros) >= 1.268
38 BuildRequires: sed >= 4.0
39 BuildRequires: sysconftool
40 Requires(post,preun): /sbin/chkconfig
41 Requires: %{name}-common = %{version}-%{release}
42 Requires: /sbin/chkconfig
43 Requires: pam >= 0.79.0
47 Conflicts: cyrus-imapd
49 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51 %define _libexecdir /usr/%{_lib}/courier-imap
52 %define _sysconfdir /etc/courier-imap
53 %define _certsdir %{_sysconfdir}/certs
54 %define _localstatedir /var/spool/courier-imap
57 Courier-IMAP is an IMAP server for Maildir mailboxes.
59 %description -l pl.UTF-8
60 Courier-IMAP jest serwerem IMAP dla skrzynek pocztowych Maildir.
63 Summary: Common files for imap and pop3 daemons
64 Summary(pl.UTF-8): Pliki wspólne dla serwerów imap i pop3
65 Group: Networking/Daemons
66 Requires(post,preun): /sbin/chkconfig
67 Requires: /sbin/chkconfig
68 Requires: courier-authlib
73 Common files for imap and pop3 daemons.
75 %description common -l pl.UTF-8
76 Pliki wspólne dla serwerów imap i pop3.
79 Summary: Deliver to a Maildir with a quota
80 Summary(pl.UTF-8): Obsługa quoty przy dostarczaniu poczty do skrzynek Maildir
81 Group: Networking/Daemons
83 %description deliverquota
84 deliverquota is a temporary hack to implement E-mail delivery to a
85 Maildir with a software-imposed quota.
87 %description deliverquota -l pl.UTF-8
88 deliverquota jest tymczasowym rozwiązaniem implementującym
89 dostarczanie e-maili do skrzynek Maildir z programowo narzuconą quotą.
92 Summary: Tool for making mail folders in Maildir format
93 Summary(pl.UTF-8): Narzędzie do tworzenia folderów w formacie Maildir
94 Group: Networking/Daemons
95 Conflicts: qmail-maildirmake
97 %description maildirmake
98 Maildirmake is a tool for making mail folders in Maildir format.
100 %description maildirmake -l pl.UTF-8
101 Maildirmake jest narzędziem do tworzenia folderów pocztowych w
105 Summary: Courier-IMAP POP3 Server
106 Summary(pl.UTF-8): Serwer Courier-IMAP POP3
107 Group: Networking/Daemons/POP3
108 Requires: %{name}-common = %{version}-%{release}
109 Requires: pam >= 0.79.0
111 Obsoletes: pop3daemon
112 Conflicts: cyrus-imapd
114 Conflicts: solid-pop3d
118 Courier-IMAP POP3 is an POP3 server for Maildir mailboxes.
120 %description pop3 -l pl.UTF-8
121 Courier-IMAP POP3 jest serwerem POP3 dla skrzynek pocztowych Maildir.
133 install %{SOURCE1} courier-imap.in
134 install %{SOURCE2} courier-imap-ssl.in
135 install %{SOURCE3} courier-pop3.in
136 install %{SOURCE4} courier-pop3-ssl.in
137 rm -f makedat/configure.in
140 # Change Makefile.am files and force recreate Makefile.in's.
141 find -type f -a '(' -name configure.in -o -name configure.ac ')' | while read FILE; do
142 cd "$(dirname "$FILE")"
144 if [ -f Makefile.am ]; then
145 %{__sed} -i -e '/_[L]DFLAGS=-static/d' Makefile.am
151 if grep -q AC_CONFIG_HEADER configure.in; then
162 --with-authchangepwdir=/var/tmp \
163 --with-certsdir=%{_certsdir} \
164 --with-mailer=/usr/lib/sendmail
169 rm -rf $RPM_BUILD_ROOT
170 install -d $RPM_BUILD_ROOT{/etc/{pam.d,rc.d/init.d,security},%{_certsdir}}
172 %{__make} -j1 install \
173 DESTDIR=$RPM_BUILD_ROOT
175 install courier-imap $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap
176 install courier-imap-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap-ssl
177 install courier-pop3 $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3
178 install courier-pop3-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3-ssl
179 install %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/imap
180 install %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/pop3
182 rm -rf $RPM_BUILD_ROOT%{_sbindir}/mk*cert
184 install imap/README README.imap
185 install imap/ChangeLog ChangeLog
186 install maildir/README.maildirquota.txt README.maildirquota
188 mv -f $RPM_BUILD_ROOT%{_datadir}/mk*cert $RPM_BUILD_ROOT%{_sbindir}
190 install tcpd/couriertls.1 $RPM_BUILD_ROOT%{_mandir}/man8/couriertls.8
191 install imap/courierpop3d.8 $RPM_BUILD_ROOT%{_mandir}/man8/courierpop3d.8
193 touch $RPM_BUILD_ROOT/etc/security/blacklist.{pop3,imap}
194 touch $RPM_BUILD_ROOT%{_sysconfdir}/shared/index
197 ./sysconftool $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
199 # set yes to start imapd and pop3d
200 sed -i 's/^POP3DSTART.*/POP3DSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/pop3d
201 sed -i 's/^IMAPDSTART.*/IMAPDSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/imapd
203 # remove unpackaged files
204 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
207 rm -rf $RPM_BUILD_ROOT
210 /sbin/chkconfig --add courier-imap
211 /sbin/chkconfig --add courier-imap-ssl
212 %service courier-imap restart "courier-imap daemon"
213 %service courier-imap-ssl restart "courier-imap-ssl daemon"
216 if [ "$1" = "0" ]; then
217 %service courier-imap stop
218 /sbin/chkconfig --del courier-imap
221 if [ "$1" = "0" ]; then
222 %service courier-imap-ssl stop
223 /sbin/chkconfig --del courier-imap-ssl
227 %triggerin -- %{name} < 3.0.5
228 if [ -f /var/lib/openssl/certs/imapd.pem ]; then
230 echo imapd.pem has been moved automatically to %{_certsdir}
232 mv -f /var/lib/openssl/certs/imapd.pem %{_certsdir}
234 if [ -f /etc/sysconfig/courier-imap ]; then
235 . /etc/sysconfig/courier-imap
236 for opt in `grep ^[^#] /etc/sysconfig/courier-imap |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
239 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd
240 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd-ssl
242 sed -i s/^SSLADDRESS=.*/"SSLADDRESS=$ADDRESS_SSL"/ %{_sysconfdir}/imapd-ssl
243 sed -i s/^SSLPORT=.*/"SSLPORT=$PORTS_SSL"/ %{_sysconfdir}/imapd-ssl
244 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd-ssl
245 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd
247 echo IMAPD config file has been rewriten to %{_sysconfdir}/imapd,imapd-ssl
248 echo please look at them
251 %service -q courier-imap restart
253 %triggerin -- %{name} < 3.0.6
254 . %{_sysconfdir}/imapd-ssl
255 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
256 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/imapd-ssl
259 %triggerin -n %{name}-common -- %{name}-userdb
261 echo courier-imap-userdb is obsolete
262 echo install courier-authlib-userdb package
265 %triggerin -n %{name}-common -- %{name}-common < 3.0.5
266 /sbin/chkconfig --del authdaemon
267 if [ -f /var/lock/subsys/authdaemon ]; then
268 kill `cat /var/lib/authdaemon/pid`
269 rm -f /var/lock/subsys/authdaemon
271 if [ -f /etc/sysconfig/authdaemon ]; then
272 . /etc/sysconfig/authdaemon
273 sed -i s/^version.*/version=authdaemond.$METHOD/ %{_sysconfdir}/authdaemonrc
276 echo Changes to version 3.0.5 :
277 echo - config files has been splited and moved to %{_sysconfdir}
278 echo - certificates directory has changed to %{_certsdir}
282 /sbin/chkconfig --add courier-pop3
283 /sbin/chkconfig --add courier-pop3-ssl
284 /sbin/chkconfig --del courier-imap-pop3 >/dev/null 2>&1 || :
285 if [ -f /var/lock/subsys/courier-imap-pop3 ]; then
286 /sbin/service courier-imap-pop3 stop >&2
287 /sbin/service courier-pop3 start >&2
289 %service courier-pop3 restart "courier-pop3 daemon"
291 %service courier-pop3-ssl restart "courier-pop3-ssl daemon"
294 if [ "$1" = "0" ]; then
295 %service courier-pop3 stop
296 /sbin/chkconfig --del courier-pop3
297 %service courier-pop3-ssl stop
298 /sbin/chkconfig --del courier-pop3-ssl
301 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.5
302 if [ -f /var/lib/openssl/certs/pop3d.pem ]; then
304 echo pop3d.pem has been moved automatically to %{_certsdir}
306 mv -f /var/lib/openssl/certs/pop3d.pem %{_certsdir}
308 if [ -f /etc/sysconfig/courier-pop3 ]; then
309 . /etc/sysconfig/courier-pop3
310 for opt in `grep ^[^#] /etc/sysconfig/courier-pop3 |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
313 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d
314 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d-ssl
316 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d-ssl
317 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d
319 echo POP3D config file has been rewriten to %{_sysconfdir}/{pop3d,pop3d-ssl}
320 echo please look at them
323 %service courier-pop3 restart
325 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.6
326 . %{_sysconfdir}/pop3d-ssl
327 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
328 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/pop3d-ssl
332 %defattr(644,root,root,755)
333 %doc maildir/README.sharedfolders.txt imap/README.proxy tcpd/README.couriertls
334 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/imap
335 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.imap
336 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd
337 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd-ssl
338 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd.cnf
339 %attr(754,root,root) /etc/rc.d/init.d/courier-imap
340 %attr(754,root,root) /etc/rc.d/init.d/courier-imap-ssl
341 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared
342 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared.tmp
343 %attr(644,daemon,daemon) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/shared/index
344 %attr(755,root,root) %{_bindir}/imapd
345 %attr(755,root,root) %{_bindir}/maildiracl
346 %attr(755,root,root) %{_bindir}/maildirkw
347 %attr(755,root,root) %{_sbindir}/imaplogin
348 %attr(755,root,root) %{_sbindir}/mkimapdcert
349 %attr(755,root,root) %{_sbindir}/sharedindexinstall
350 %attr(755,root,root) %{_sbindir}/sharedindexsplit
351 %attr(755,root,root) %{_libexecdir}/imapd.rc
352 %attr(755,root,root) %{_libexecdir}/imapd-ssl.rc
353 %{_mandir}/man8/imapd*
354 %{_mandir}/man1/maildiracl.1*
355 %{_mandir}/man1/maildirkw.1*
358 %defattr(644,root,root,755)
359 %doc AUTHORS ChangeLog imap/BUGS INSTALL README*
360 %attr(751,root,root) %dir %{_sysconfdir}
361 %attr(750,root,root) %dir %{_certsdir}
362 %attr(770,daemon,daemon) %dir %{_localstatedir}
364 %{_sysconfdir}/quotawarnmsg.example
365 %attr(755,root,root) %{_bindir}/couriertls
366 %attr(755,root,root) %{_libexecdir}/couriertcpd
367 %{_mandir}/man1/couriert*
368 %{_mandir}/man8/couriert*
372 %defattr(644,root,root,755)
373 %attr(755,root,root) %{_bindir}/deliverquota
374 %{_mandir}/man8/deliverquota*
377 %defattr(644,root,root,755)
378 %attr(755,root,root) %{_bindir}/maildirmake
379 %{_mandir}/man1/maildirmake*
382 %defattr(644,root,root,755)
383 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/pop3
384 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.pop3
385 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d
386 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d-ssl
387 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d.cnf
388 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3
389 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3-ssl
390 %attr(755,root,root) %{_bindir}/pop3d
391 %attr(755,root,root) %{_sbindir}/mkpop3dcert
392 %attr(755,root,root) %{_sbindir}/pop3login
393 %attr(755,root,root) %{_libexecdir}/pop3d.rc
394 %attr(755,root,root) %{_libexecdir}/pop3d-ssl.rc
395 %{_mandir}/man8/courierpop*