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: 6e25e51faeec55a695242679311b595f
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 Patch5: %{name}-link.patch
29 URL: http://www.courier-mta.org/imap/
30 BuildRequires: autoconf >= 2.54
31 BuildRequires: automake
32 BuildRequires: courier-authlib-devel >= 0.59
33 BuildRequires: db-devel
34 BuildRequires: fam-devel
35 BuildRequires: libstdc++-devel
36 BuildRequires: libtool
37 BuildRequires: openssl-devel >= 0.9.7d
39 BuildRequires: rpmbuild(macros) >= 1.268
40 BuildRequires: sed >= 4.0
41 BuildRequires: sysconftool
42 Requires(post,preun): /sbin/chkconfig
43 Requires: %{name}-common = %{version}-%{release}
44 Requires: /sbin/chkconfig
45 Requires: pam >= 0.79.0
49 Conflicts: cyrus-imapd
51 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53 %define _libexecdir /usr/%{_lib}/courier-imap
54 %define _sysconfdir /etc/courier-imap
55 %define _certsdir %{_sysconfdir}/certs
56 %define _localstatedir /var/spool/courier-imap
59 Courier-IMAP is an IMAP server for Maildir mailboxes.
61 %description -l pl.UTF-8
62 Courier-IMAP jest serwerem IMAP dla skrzynek pocztowych Maildir.
65 Summary: Common files for imap and pop3 daemons
66 Summary(pl.UTF-8): Pliki wspólne dla serwerów imap i pop3
67 Group: Networking/Daemons
68 Requires(post,preun): /sbin/chkconfig
69 Requires: /sbin/chkconfig
70 Requires: courier-authlib
75 Common files for imap and pop3 daemons.
77 %description common -l pl.UTF-8
78 Pliki wspólne dla serwerów imap i pop3.
81 Summary: Deliver to a Maildir with a quota
82 Summary(pl.UTF-8): Obsługa quoty przy dostarczaniu poczty do skrzynek Maildir
83 Group: Networking/Daemons
85 %description deliverquota
86 deliverquota is a temporary hack to implement E-mail delivery to a
87 Maildir with a software-imposed quota.
89 %description deliverquota -l pl.UTF-8
90 deliverquota jest tymczasowym rozwiązaniem implementującym
91 dostarczanie e-maili do skrzynek Maildir z programowo narzuconą quotą.
94 Summary: Tool for making mail folders in Maildir format
95 Summary(pl.UTF-8): Narzędzie do tworzenia folderów w formacie Maildir
96 Group: Networking/Daemons
97 Conflicts: qmail-maildirmake
99 %description maildirmake
100 Maildirmake is a tool for making mail folders in Maildir format.
102 %description maildirmake -l pl.UTF-8
103 Maildirmake jest narzędziem do tworzenia folderów pocztowych w
107 Summary: Courier-IMAP POP3 Server
108 Summary(pl.UTF-8): Serwer Courier-IMAP POP3
109 Group: Networking/Daemons
110 Requires: %{name}-common = %{version}-%{release}
111 Requires: pam >= 0.79.0
113 Obsoletes: pop3daemon
114 Conflicts: cyrus-imapd
116 Conflicts: solid-pop3d
120 Courier-IMAP POP3 is an POP3 server for Maildir mailboxes.
122 %description pop3 -l pl.UTF-8
123 Courier-IMAP POP3 jest serwerem POP3 dla skrzynek pocztowych Maildir.
136 install %{SOURCE1} courier-imap.in
137 install %{SOURCE2} courier-imap-ssl.in
138 install %{SOURCE3} courier-pop3.in
139 install %{SOURCE4} courier-pop3-ssl.in
140 rm -f makedat/configure.in
144 # Change Makefile.am files and force recreate Makefile.in's.
145 find -type f -a '(' -name configure.in -o -name configure.ac ')' | while read FILE; do
146 cd "$(dirname "$FILE")"
148 if [ -f Makefile.am ]; then
149 %{__sed} -i -e '/_[L]DFLAGS=-static/d' Makefile.am
164 --with-authchangepwdir=/var/tmp \
165 --with-certsdir=%{_certsdir} \
166 --with-mailer=/usr/lib/sendmail
171 rm -rf $RPM_BUILD_ROOT
172 install -d $RPM_BUILD_ROOT{/etc/{pam.d,rc.d/init.d,security},%{_certsdir}}
174 %{__make} -j1 install \
175 DESTDIR=$RPM_BUILD_ROOT
177 install courier-imap $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap
178 install courier-imap-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap-ssl
179 install courier-pop3 $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3
180 install courier-pop3-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3-ssl
181 install %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/imap
182 install %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/pop3
184 rm -rf $RPM_BUILD_ROOT%{_sbindir}/mk*cert
186 install imap/README README.imap
187 install imap/ChangeLog ChangeLog
188 install maildir/README.maildirquota.txt README.maildirquota
190 mv -f $RPM_BUILD_ROOT%{_datadir}/mk*cert $RPM_BUILD_ROOT%{_sbindir}
192 install tcpd/couriertls.1 $RPM_BUILD_ROOT%{_mandir}/man8/couriertls.8
193 install imap/courierpop3d.8 $RPM_BUILD_ROOT%{_mandir}/man8/courierpop3d.8
195 touch $RPM_BUILD_ROOT/etc/security/blacklist.{pop3,imap}
196 touch $RPM_BUILD_ROOT%{_sysconfdir}/shared/index
199 ./sysconftool $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
201 # set yes to start imapd and pop3d
202 sed -i 's/^POP3DSTART.*/POP3DSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/pop3d
203 sed -i 's/^IMAPDSTART.*/IMAPDSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/imapd
205 # remove unpackaged files
206 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
209 rm -rf $RPM_BUILD_ROOT
212 /sbin/chkconfig --add courier-imap
213 /sbin/chkconfig --add courier-imap-ssl
214 %service courier-imap restart "courier-imap daemon"
215 %service courier-imap-ssl restart "courier-imap-ssl daemon"
218 if [ "$1" = "0" ]; then
219 %service courier-imap stop
220 /sbin/chkconfig --del courier-imap
223 if [ "$1" = "0" ]; then
224 %service courier-imap-ssl stop
225 /sbin/chkconfig --del courier-imap-ssl
229 %triggerin -- %{name} < 3.0.5
230 if [ -f /var/lib/openssl/certs/imapd.pem ]; then
232 echo imapd.pem has been moved automatically to %{_certsdir}
234 mv -f /var/lib/openssl/certs/imapd.pem %{_certsdir}
236 if [ -f /etc/sysconfig/courier-imap ]; then
237 . /etc/sysconfig/courier-imap
238 for opt in `grep ^[^#] /etc/sysconfig/courier-imap |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
241 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd
242 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd-ssl
244 sed -i s/^SSLADDRESS=.*/"SSLADDRESS=$ADDRESS_SSL"/ %{_sysconfdir}/imapd-ssl
245 sed -i s/^SSLPORT=.*/"SSLPORT=$PORTS_SSL"/ %{_sysconfdir}/imapd-ssl
246 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd-ssl
247 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd
249 echo IMAPD config file has been rewriten to %{_sysconfdir}/imapd,imapd-ssl
250 echo please look at them
253 %service -q courier-imap restart
255 %triggerin -- %{name} < 3.0.6
256 . %{_sysconfdir}/imapd-ssl
257 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
258 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/imapd-ssl
261 %triggerin -n %{name}-common -- %{name}-userdb
263 echo courier-imap-userdb is obsolete
264 echo install courier-authlib-userdb package
267 %triggerin -n %{name}-common -- %{name}-common < 3.0.5
268 /sbin/chkconfig --del authdaemon
269 if [ -f /var/lock/subsys/authdaemon ]; then
270 kill `cat /var/lib/authdaemon/pid`
271 rm -f /var/lock/subsys/authdaemon
273 if [ -f /etc/sysconfig/authdaemon ]; then
274 . /etc/sysconfig/authdaemon
275 sed -i s/^version.*/version=authdaemond.$METHOD/ %{_sysconfdir}/authdaemonrc
278 echo Changes to version 3.0.5 :
279 echo - config files has been splited and moved to %{_sysconfdir}
280 echo - certificates directory has changed to %{_certsdir}
284 /sbin/chkconfig --add courier-pop3
285 /sbin/chkconfig --add courier-pop3-ssl
286 /sbin/chkconfig --del courier-imap-pop3 >/dev/null 2>&1 || :
287 if [ -f /var/lock/subsys/courier-imap-pop3 ]; then
288 /sbin/service courier-imap-pop3 stop >&2
289 /sbin/service courier-pop3 start >&2
291 %service courier-pop3 restart "courier-pop3 daemon"
293 %service courier-pop3-ssl restart "courier-pop3-ssl daemon"
296 if [ "$1" = "0" ]; then
297 %service courier-pop3 stop
298 /sbin/chkconfig --del courier-pop3
299 %service courier-pop3-ssl stop
300 /sbin/chkconfig --del courier-pop3-ssl
303 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.5
304 if [ -f /var/lib/openssl/certs/pop3d.pem ]; then
306 echo pop3d.pem has been moved automatically to %{_certsdir}
308 mv -f /var/lib/openssl/certs/pop3d.pem %{_certsdir}
310 if [ -f /etc/sysconfig/courier-pop3 ]; then
311 . /etc/sysconfig/courier-pop3
312 for opt in `grep ^[^#] /etc/sysconfig/courier-pop3 |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
315 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d
316 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d-ssl
318 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d-ssl
319 sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d
321 echo POP3D config file has been rewriten to %{_sysconfdir}/{pop3d,pop3d-ssl}
322 echo please look at them
325 %service courier-pop3 restart
327 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.6
328 . %{_sysconfdir}/pop3d-ssl
329 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
330 sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/pop3d-ssl
334 %defattr(644,root,root,755)
335 %doc maildir/README.sharedfolders.txt imap/README.proxy tcpd/README.couriertls
336 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/imap
337 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.imap
338 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd
339 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd-ssl
340 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd.cnf
341 %attr(754,root,root) /etc/rc.d/init.d/courier-imap
342 %attr(754,root,root) /etc/rc.d/init.d/courier-imap-ssl
343 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared
344 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared.tmp
345 %attr(644,daemon,daemon) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/shared/index
346 %attr(755,root,root) %{_bindir}/imapd
347 %attr(755,root,root) %{_bindir}/maildiracl
348 %attr(755,root,root) %{_bindir}/maildirkw
349 %attr(755,root,root) %{_sbindir}/imaplogin
350 %attr(755,root,root) %{_sbindir}/mkimapdcert
351 %attr(755,root,root) %{_sbindir}/sharedindexinstall
352 %attr(755,root,root) %{_sbindir}/sharedindexsplit
353 %attr(755,root,root) %{_libexecdir}/imapd.rc
354 %attr(755,root,root) %{_libexecdir}/imapd-ssl.rc
355 %{_mandir}/man8/imapd*
356 %{_mandir}/man1/maildiracl.1*
357 %{_mandir}/man1/maildirkw.1*
360 %defattr(644,root,root,755)
361 %doc AUTHORS ChangeLog imap/BUGS INSTALL README*
362 %attr(751,root,root) %dir %{_sysconfdir}
363 %attr(750,root,root) %dir %{_certsdir}
364 %attr(770,daemon,daemon) %dir %{_localstatedir}
366 %{_sysconfdir}/quotawarnmsg.example
367 %attr(755,root,root) %{_bindir}/couriertls
368 %attr(755,root,root) %{_libexecdir}/couriertcpd
369 %{_mandir}/man1/couriert*
370 %{_mandir}/man8/couriert*
374 %defattr(644,root,root,755)
375 %attr(755,root,root) %{_bindir}/deliverquota
376 %{_mandir}/man8/deliverquota*
379 %defattr(644,root,root,755)
380 %attr(755,root,root) %{_bindir}/maildirmake
381 %{_mandir}/man1/maildirmake*
384 %defattr(644,root,root,755)
385 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/pop3
386 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.pop3
387 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d
388 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d-ssl
389 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d.cnf
390 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3
391 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3-ssl
392 %attr(755,root,root) %{_bindir}/pop3d
393 %attr(755,root,root) %{_sbindir}/mkpop3dcert
394 %attr(755,root,root) %{_sbindir}/pop3login
395 %attr(755,root,root) %{_libexecdir}/pop3d.rc
396 %attr(755,root,root) %{_libexecdir}/pop3d-ssl.rc
397 %{_mandir}/man8/courierpop*