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
13 Summary: Courier-IMAP server
14 Summary(pl.UTF-8): Serwer Courier-IMAP
19 Group: Networking/Daemons
20 Source0: http://downloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2
21 # Source0-md5: 0bbaffd067199ee35de5b15ea02e6d53
23 Source2: %{name}-ssl.init
24 Source3: %{name}-pop3.init
25 Source4: %{name}-pop3-ssl.init
27 Source6: %{name}-pop3.pamd
28 Patch0: %{name}-dirs.patch
29 Patch1: %{name}-certsdir.patch
30 Patch2: %{name}-maildir.patch
31 Patch3: %{name}-toplevel.patch
32 Patch4: %{name}-drop-makedat.patch
33 URL: http://www.courier-mta.org/imap/
34 BuildRequires: autoconf >= 2.54
35 BuildRequires: automake
36 BuildRequires: courier-authlib-devel >= 0.61
37 BuildRequires: db-devel
38 BuildRequires: gdbm-devel
39 BuildRequires: gnet-devel
40 BuildRequires: libidn-devel
41 %{?with_fam:BuildRequires: gamin-devel}
42 BuildRequires: libstdc++-devel
43 BuildRequires: libtool
44 BuildRequires: openssl-devel >= 0.9.7d
45 BuildRequires: pkgconfig
47 BuildRequires: rpmbuild(macros) >= 1.268
48 BuildRequires: sed >= 4.0
49 BuildRequires: sysconftool
50 Requires(post,preun): /sbin/chkconfig
51 Requires: %{name}-common = %{version}-%{release}
52 Requires: /sbin/chkconfig
53 Requires: pam >= 0.79.0
57 Conflicts: cyrus-imapd
59 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
61 %define _libexecdir /usr/%{_lib}/courier-imap
62 %define _sysconfdir /etc/courier-imap
63 %define _certsdir %{_sysconfdir}/certs
64 %define _localstatedir /var/spool/courier-imap
67 Courier-IMAP is an IMAP server for Maildir mailboxes.
69 %description -l pl.UTF-8
70 Courier-IMAP jest serwerem IMAP dla skrzynek pocztowych Maildir.
73 Summary: Common files for imap and pop3 daemons
74 Summary(pl.UTF-8): Pliki wspólne dla serwerów imap i pop3
75 Group: Networking/Daemons
76 Requires(post,preun): /sbin/chkconfig
77 Requires: /sbin/chkconfig
78 Requires: courier-authlib
83 Common files for imap and pop3 daemons.
85 %description common -l pl.UTF-8
86 Pliki wspólne dla serwerów imap i pop3.
89 Summary: Deliver to a Maildir with a quota
90 Summary(pl.UTF-8): Obsługa quoty przy dostarczaniu poczty do skrzynek Maildir
91 Group: Networking/Daemons
93 %description deliverquota
94 deliverquota is a temporary hack to implement E-mail delivery to a
95 Maildir with a software-imposed quota.
97 %description deliverquota -l pl.UTF-8
98 deliverquota jest tymczasowym rozwiązaniem implementującym
99 dostarczanie e-maili do skrzynek Maildir z programowo narzuconą quotą.
102 Summary: Tool for making mail folders in Maildir format
103 Summary(pl.UTF-8): Narzędzie do tworzenia folderów w formacie Maildir
104 Group: Networking/Daemons
105 Conflicts: qmail-maildirmake
107 %description maildirmake
108 Maildirmake is a tool for making mail folders in Maildir format.
110 %description maildirmake -l pl.UTF-8
111 Maildirmake jest narzędziem do tworzenia folderów pocztowych w
115 Summary: Courier-IMAP POP3 Server
116 Summary(pl.UTF-8): Serwer Courier-IMAP POP3
117 Group: Networking/Daemons/POP3
118 Requires: %{name}-common = %{version}-%{release}
119 Requires: pam >= 0.79.0
121 Obsoletes: pop3daemon
122 Conflicts: cyrus-imapd
124 Conflicts: solid-pop3d
128 Courier-IMAP POP3 is an POP3 server for Maildir mailboxes.
130 %description pop3 -l pl.UTF-8
131 Courier-IMAP POP3 jest serwerem POP3 dla skrzynek pocztowych Maildir.
143 cp -p %{SOURCE1} courier-imap.in
144 cp -p %{SOURCE2} courier-imap-ssl.in
145 cp -p %{SOURCE3} courier-pop3.in
146 cp -p %{SOURCE4} courier-pop3-ssl.in
147 rm -f makedat/configure.in
150 # Change Makefile.am files and force recreate Makefile.in's.
151 find -type f -a '(' -name configure.in -o -name configure.ac ')' | while read FILE; do
152 cd "$(dirname "$FILE")"
154 if [ -f Makefile.am ]; then
155 %{__sed} -i -e '/_[L]DFLAGS=-static/d' Makefile.am
157 %{__sed} -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.in
162 if grep -q AC_CONFIG_HEADER configure.in; then
171 ac_cv_header_fam_h=no \
172 ac_cv_lib_fam_FAMOpen=no \
177 --with-authchangepwdir=/var/tmp \
178 --with-certsdir=%{_certsdir} \
179 --with-mailer=/usr/lib/sendmail
184 rm -rf $RPM_BUILD_ROOT
185 install -d $RPM_BUILD_ROOT{/etc/{pam.d,rc.d/init.d,security},%{_certsdir}}
187 %{__make} -j1 install \
188 DESTDIR=$RPM_BUILD_ROOT
190 install -p courier-imap $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap
191 install -p courier-imap-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap-ssl
192 install -p courier-pop3 $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3
193 install -p courier-pop3-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3-ssl
194 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/imap
195 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/pop3
197 rm -rf $RPM_BUILD_ROOT%{_sbindir}/mk*cert
199 cp -pf imap/README README.imap
200 cp -pf imap/ChangeLog ChangeLog
201 cp -pf maildir/README.maildirquota.txt README.maildirquota
203 mv -f $RPM_BUILD_ROOT%{_datadir}/mk*cert $RPM_BUILD_ROOT%{_sbindir}
205 cp -p tcpd/couriertls.1 $RPM_BUILD_ROOT%{_mandir}/man8/couriertls.8
206 cp -p imap/courierpop3d.8 $RPM_BUILD_ROOT%{_mandir}/man8/courierpop3d.8
208 touch $RPM_BUILD_ROOT/etc/security/blacklist.{pop3,imap}
209 touch $RPM_BUILD_ROOT%{_sysconfdir}/shared/index
212 ./sysconftool $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
214 # set yes to start imapd and pop3d
215 sed -i 's/^POP3DSTART.*/POP3DSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/pop3d
216 sed -i 's/^IMAPDSTART.*/IMAPDSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/imapd
218 # remove unpackaged files
219 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
222 rm -rf $RPM_BUILD_ROOT
225 /sbin/chkconfig --add courier-imap
226 /sbin/chkconfig --add courier-imap-ssl
227 %service courier-imap restart "courier-imap daemon"
228 %service courier-imap-ssl restart "courier-imap-ssl daemon"
231 if [ "$1" = "0" ]; then
232 %service courier-imap stop
233 /sbin/chkconfig --del courier-imap
236 if [ "$1" = "0" ]; then
237 %service courier-imap-ssl stop
238 /sbin/chkconfig --del courier-imap-ssl
242 %triggerin -- %{name} < 3.0.5
243 if [ -f /var/lib/openssl/certs/imapd.pem ]; then
245 echo imapd.pem has been moved automatically to %{_certsdir}
247 mv -f /var/lib/openssl/certs/imapd.pem %{_certsdir}
249 if [ -f /etc/sysconfig/courier-imap ]; then
250 . /etc/sysconfig/courier-imap
251 for opt in `grep ^[^#] /etc/sysconfig/courier-imap |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
254 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd
255 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd-ssl
257 sed -i s/^SSLADDRESS=.*/"SSLADDRESS=$ADDRESS_SSL"/ %{_sysconfdir}/imapd-ssl
258 sed -i s/^SSLPORT=.*/"SSLPORT=$PORTS_SSL"/ %{_sysconfdir}/imapd-ssl
259 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd-ssl
260 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd
262 echo IMAPD config file has been rewriten to %{_sysconfdir}/imapd,imapd-ssl
263 echo please look at them
266 %service -q courier-imap restart
268 %triggerin -- %{name} < 3.0.6
269 . %{_sysconfdir}/imapd-ssl
270 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
271 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/imapd-ssl
274 %triggerin -n %{name}-common -- %{name}-userdb
276 echo courier-imap-userdb is obsolete
277 echo install courier-authlib-userdb package
280 %triggerin -n %{name}-common -- %{name}-common < 3.0.5
281 /sbin/chkconfig --del authdaemon
282 if [ -f /var/lock/subsys/authdaemon ]; then
283 kill `cat /var/lib/authdaemon/pid`
284 rm -f /var/lock/subsys/authdaemon
286 if [ -f /etc/sysconfig/authdaemon ]; then
287 . /etc/sysconfig/authdaemon
288 sed -i s/^version.*/version=authdaemond.$METHOD/ %{_sysconfdir}/authdaemonrc
291 echo Changes to version 3.0.5 :
292 echo - config files has been splited and moved to %{_sysconfdir}
293 echo - certificates directory has changed to %{_certsdir}
297 /sbin/chkconfig --add courier-pop3
298 /sbin/chkconfig --add courier-pop3-ssl
299 /sbin/chkconfig --del courier-imap-pop3 >/dev/null 2>&1 || :
300 if [ -f /var/lock/subsys/courier-imap-pop3 ]; then
301 /sbin/service courier-imap-pop3 stop >&2
302 /sbin/service courier-pop3 start >&2
304 %service courier-pop3 restart "courier-pop3 daemon"
306 %service courier-pop3-ssl restart "courier-pop3-ssl daemon"
309 if [ "$1" = "0" ]; then
310 %service courier-pop3 stop
311 /sbin/chkconfig --del courier-pop3
312 %service courier-pop3-ssl stop
313 /sbin/chkconfig --del courier-pop3-ssl
316 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.5
317 if [ -f /var/lib/openssl/certs/pop3d.pem ]; then
319 echo pop3d.pem has been moved automatically to %{_certsdir}
321 mv -f /var/lib/openssl/certs/pop3d.pem %{_certsdir}
323 if [ -f /etc/sysconfig/courier-pop3 ]; then
324 . /etc/sysconfig/courier-pop3
325 for opt in `grep ^[^#] /etc/sysconfig/courier-pop3 |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
328 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d
329 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d-ssl
331 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d-ssl
332 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d
334 echo POP3D config file has been rewriten to %{_sysconfdir}/{pop3d,pop3d-ssl}
335 echo please look at them
338 %service courier-pop3 restart
340 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.6
341 . %{_sysconfdir}/pop3d-ssl
342 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
343 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/pop3d-ssl
347 %defattr(644,root,root,755)
348 %doc maildir/README.sharedfolders.txt imap/README.proxy tcpd/README.couriertls
349 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/imap
350 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.imap
351 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd
352 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd-ssl
353 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd.cnf
354 %attr(754,root,root) /etc/rc.d/init.d/courier-imap
355 %attr(754,root,root) /etc/rc.d/init.d/courier-imap-ssl
356 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared
357 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared.tmp
358 %attr(644,daemon,daemon) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/shared/index
359 %attr(755,root,root) %{_bindir}/imapd
360 %attr(755,root,root) %{_bindir}/maildiracl
361 %attr(755,root,root) %{_bindir}/maildirkw
362 %attr(755,root,root) %{_sbindir}/imaplogin
363 %attr(755,root,root) %{_sbindir}/mkimapdcert
364 %attr(755,root,root) %{_sbindir}/sharedindexinstall
365 %attr(755,root,root) %{_sbindir}/sharedindexsplit
366 %attr(755,root,root) %{_libexecdir}/imapd.rc
367 %attr(755,root,root) %{_libexecdir}/imapd-ssl.rc
368 %{_mandir}/man8/imapd*
369 %{_mandir}/man1/maildiracl.1*
370 %{_mandir}/man1/maildirkw.1*
373 %defattr(644,root,root,755)
374 %doc AUTHORS ChangeLog imap/BUGS INSTALL README*
375 %attr(751,root,root) %dir %{_sysconfdir}
376 %attr(750,root,root) %dir %{_certsdir}
377 %attr(770,daemon,daemon) %dir %{_localstatedir}
379 %{_sysconfdir}/quotawarnmsg.example
380 %attr(755,root,root) %{_bindir}/couriertls
381 %attr(755,root,root) %{_libexecdir}/couriertcpd
382 %{_mandir}/man1/couriert*
383 %{_mandir}/man8/couriert*
387 %defattr(644,root,root,755)
388 %attr(755,root,root) %{_bindir}/deliverquota
389 %{_mandir}/man8/deliverquota*
392 %defattr(644,root,root,755)
393 %attr(755,root,root) %{_bindir}/maildirmake
394 %{_mandir}/man1/maildirmake*
397 %defattr(644,root,root,755)
398 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/pop3
399 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.pop3
400 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d
401 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d-ssl
402 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d.cnf
403 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3
404 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3-ssl
405 %attr(755,root,root) %{_bindir}/pop3d
406 %attr(755,root,root) %{_sbindir}/mkpop3dcert
407 %attr(755,root,root) %{_sbindir}/pop3login
408 %attr(755,root,root) %{_libexecdir}/pop3d.rc
409 %attr(755,root,root) %{_libexecdir}/pop3d-ssl.rc
410 %{_mandir}/man8/courierpop*