]> git.pld-linux.org Git - packages/courier-imap.git/blob - courier-imap.spec
- rel 3
[packages/courier-imap.git] / courier-imap.spec
1 # TODO:
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
5 #
6 %bcond_with     toplevel        # Allow toplevel folders. More info: http://www.ricky-chan.co.uk/courier/
7 #
8 Summary:        Courier-IMAP server
9 Summary(pl.UTF-8):      Serwer Courier-IMAP
10 Name:           courier-imap
11 Version:        4.4.1
12 Release:        3
13 License:        GPL
14 Group:          Networking/Daemons
15 Source0:        http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
16 # Source0-md5:  71482dff367e5161a3c0f9c61bbfd2b1
17 Source1:        %{name}.init
18 Source2:        %{name}-ssl.init
19 Source3:        %{name}-pop3.init
20 Source4:        %{name}-pop3-ssl.init
21 Source5:        %{name}.pamd
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:  fam-devel
34 BuildRequires:  libstdc++-devel
35 BuildRequires:  libtool
36 BuildRequires:  openssl-devel >= 0.9.7d
37 BuildRequires:  procps
38 BuildRequires:  rpmbuild(macros) >= 1.268
39 BuildRequires:  sed >= 4.0
40 BuildRequires:  sysconftool
41 Requires(post,preun):   /sbin/chkconfig
42 Requires:       %{name}-common = %{version}-%{release}
43 Requires:       /sbin/chkconfig
44 Requires:       pam >= 0.79.0
45 Requires:       rc-scripts
46 Provides:       imapdaemon
47 Obsoletes:      imapdaemon
48 Conflicts:      cyrus-imapd
49 Conflicts:      imap
50 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51
52 %define         _libexecdir     /usr/%{_lib}/courier-imap
53 %define         _sysconfdir     /etc/courier-imap
54 %define         _certsdir       %{_sysconfdir}/certs
55 %define         _localstatedir  /var/spool/courier-imap
56
57 %description
58 Courier-IMAP is an IMAP server for Maildir mailboxes.
59
60 %description -l pl.UTF-8
61 Courier-IMAP jest serwerem IMAP dla skrzynek pocztowych Maildir.
62
63 %package common
64 Summary:        Common files for imap and pop3 daemons
65 Summary(pl.UTF-8):      Pliki wspólne dla serwerów imap i pop3
66 Group:          Networking/Daemons
67 Requires(post,preun):   /sbin/chkconfig
68 Requires:       /sbin/chkconfig
69 Requires:       courier-authlib
70 Requires:       procps
71 Requires:       rc-scripts
72
73 %description common
74 Common files for imap and pop3 daemons.
75
76 %description common -l pl.UTF-8
77 Pliki wspólne dla serwerów imap i pop3.
78
79 %package deliverquota
80 Summary:        Deliver to a Maildir with a quota
81 Summary(pl.UTF-8):      Obsługa quoty przy dostarczaniu poczty do skrzynek Maildir
82 Group:          Networking/Daemons
83
84 %description deliverquota
85 deliverquota is a temporary hack to implement E-mail delivery to a
86 Maildir with a software-imposed quota.
87
88 %description deliverquota -l pl.UTF-8
89 deliverquota jest tymczasowym rozwiązaniem implementującym
90 dostarczanie e-maili do skrzynek Maildir z programowo narzuconą quotą.
91
92 %package maildirmake
93 Summary:        Tool for making mail folders in Maildir format
94 Summary(pl.UTF-8):      Narzędzie do tworzenia folderów w formacie Maildir
95 Group:          Networking/Daemons
96 Conflicts:      qmail-maildirmake
97
98 %description maildirmake
99 Maildirmake is a tool for making mail folders in Maildir format.
100
101 %description maildirmake -l pl.UTF-8
102 Maildirmake jest narzędziem do tworzenia folderów pocztowych w
103 formacie Maildir.
104
105 %package pop3
106 Summary:        Courier-IMAP POP3 Server
107 Summary(pl.UTF-8):      Serwer Courier-IMAP POP3
108 Group:          Networking/Daemons/POP3
109 Requires:       %{name}-common = %{version}-%{release}
110 Requires:       pam >= 0.79.0
111 Provides:       pop3daemon
112 Obsoletes:      pop3daemon
113 Conflicts:      cyrus-imapd
114 Conflicts:      imap-pop3
115 Conflicts:      solid-pop3d
116 Conflicts:      tpop3d
117
118 %description pop3
119 Courier-IMAP POP3 is an POP3 server for Maildir mailboxes.
120
121 %description pop3 -l pl.UTF-8
122 Courier-IMAP POP3 jest serwerem POP3 dla skrzynek pocztowych Maildir.
123
124 %prep
125 %setup -q
126 %patch0 -p1
127 %patch1 -p1
128 %patch2 -p1
129 %if %{with toplevel}
130 %patch3 -p1
131 %endif
132 %patch4 -p1
133
134 install %{SOURCE1} courier-imap.in
135 install %{SOURCE2} courier-imap-ssl.in
136 install %{SOURCE3} courier-pop3.in
137 install %{SOURCE4} courier-pop3-ssl.in
138 rm -f makedat/configure.in
139
140 %build
141 # Change Makefile.am files and force recreate Makefile.in's.
142 find -type f -a '(' -name configure.in -o -name configure.ac ')' | while read FILE; do
143         cd "$(dirname "$FILE")"
144
145         if [ -f Makefile.am ]; then
146                 %{__sed} -i -e '/_[L]DFLAGS=-static/d' Makefile.am
147         fi
148
149         %{__libtoolize}
150         %{__aclocal}
151         %{__autoconf}
152         if grep -q AC_CONFIG_HEADER configure.in; then
153                 %{__autoheader}
154         fi
155         %{__automake}
156
157         cd -
158 done
159
160 %configure \
161         --with-db=db \
162         --enable-unicode \
163         --with-authchangepwdir=/var/tmp \
164         --with-certsdir=%{_certsdir} \
165         --with-mailer=/usr/lib/sendmail
166
167 %{__make} -j1
168
169 %install
170 rm -rf $RPM_BUILD_ROOT
171 install -d $RPM_BUILD_ROOT{/etc/{pam.d,rc.d/init.d,security},%{_certsdir}}
172
173 %{__make} -j1 install \
174         DESTDIR=$RPM_BUILD_ROOT
175
176 install courier-imap $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap
177 install courier-imap-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-imap-ssl
178 install courier-pop3 $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3
179 install courier-pop3-ssl $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3-ssl
180 install %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/imap
181 install %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/pop3
182
183 rm -rf $RPM_BUILD_ROOT%{_sbindir}/mk*cert
184
185 install imap/README README.imap
186 install imap/ChangeLog ChangeLog
187 install maildir/README.maildirquota.txt README.maildirquota
188
189 mv -f $RPM_BUILD_ROOT%{_datadir}/mk*cert $RPM_BUILD_ROOT%{_sbindir}
190
191 install tcpd/couriertls.1 $RPM_BUILD_ROOT%{_mandir}/man8/couriertls.8
192 install imap/courierpop3d.8 $RPM_BUILD_ROOT%{_mandir}/man8/courierpop3d.8
193
194 touch $RPM_BUILD_ROOT/etc/security/blacklist.{pop3,imap}
195 touch $RPM_BUILD_ROOT%{_sysconfdir}/shared/index
196
197 # make config files
198 ./sysconftool $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
199
200 # set yes to start imapd and pop3d
201 sed -i 's/^POP3DSTART.*/POP3DSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/pop3d
202 sed -i 's/^IMAPDSTART.*/IMAPDSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/imapd
203
204 # remove unpackaged files
205 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
206
207 %clean
208 rm -rf $RPM_BUILD_ROOT
209
210 %post
211 /sbin/chkconfig --add courier-imap
212 /sbin/chkconfig --add courier-imap-ssl
213 %service courier-imap restart "courier-imap daemon"
214 %service courier-imap-ssl restart "courier-imap-ssl daemon"
215
216 %preun
217 if [ "$1" = "0" ]; then
218         %service courier-imap stop
219         /sbin/chkconfig --del courier-imap
220 fi
221
222 if [ "$1" = "0" ]; then
223         %service courier-imap-ssl stop
224         /sbin/chkconfig --del courier-imap-ssl
225 fi
226
227
228 %triggerin -- %{name} < 3.0.5
229 if [ -f /var/lib/openssl/certs/imapd.pem ]; then
230         echo
231         echo imapd.pem has been moved automatically to %{_certsdir}
232         echo
233         mv -f /var/lib/openssl/certs/imapd.pem %{_certsdir}
234 fi
235 if [ -f /etc/sysconfig/courier-imap ]; then
236         . /etc/sysconfig/courier-imap
237         for opt in `grep ^[^#] /etc/sysconfig/courier-imap |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
238         do
239                 eval opt2=\$$opt
240                 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd
241                 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/imapd-ssl
242         done
243         sed -i s/^SSLADDRESS=.*/"SSLADDRESS=$ADDRESS_SSL"/ %{_sysconfdir}/imapd-ssl
244         sed -i s/^SSLPORT=.*/"SSLPORT=$PORTS_SSL"/ %{_sysconfdir}/imapd-ssl
245         sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd-ssl
246         sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/imapd
247         echo
248         echo IMAPD config file has been rewriten to %{_sysconfdir}/imapd,imapd-ssl
249         echo please look at them
250         echo
251 fi
252 %service -q courier-imap restart
253
254 %triggerin -- %{name} < 3.0.6
255 . %{_sysconfdir}/imapd-ssl
256 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
257         sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/imapd-ssl
258 fi
259
260 %triggerin -n %{name}-common -- %{name}-userdb
261 echo
262 echo courier-imap-userdb is obsolete
263 echo install courier-authlib-userdb package
264 echo
265
266 %triggerin -n %{name}-common -- %{name}-common < 3.0.5
267 /sbin/chkconfig --del authdaemon
268 if [ -f /var/lock/subsys/authdaemon ]; then
269         kill `cat /var/lib/authdaemon/pid`
270         rm -f /var/lock/subsys/authdaemon
271 fi
272 if [ -f /etc/sysconfig/authdaemon ]; then
273         . /etc/sysconfig/authdaemon
274         sed -i s/^version.*/version=authdaemond.$METHOD/ %{_sysconfdir}/authdaemonrc
275 fi
276 echo
277 echo Changes to version 3.0.5 :
278 echo - config files has been splited and moved to %{_sysconfdir}
279 echo - certificates directory has changed to %{_certsdir}
280 echo
281
282 %post pop3
283 /sbin/chkconfig --add courier-pop3
284 /sbin/chkconfig --add courier-pop3-ssl
285 /sbin/chkconfig --del courier-imap-pop3 >/dev/null 2>&1 || :
286 if [ -f /var/lock/subsys/courier-imap-pop3 ]; then
287         /sbin/service courier-imap-pop3 stop >&2
288         /sbin/service courier-pop3 start >&2
289 else
290         %service courier-pop3 restart "courier-pop3 daemon"
291 fi
292 %service courier-pop3-ssl restart "courier-pop3-ssl daemon"
293
294 %preun pop3
295 if [ "$1" = "0" ]; then
296         %service courier-pop3 stop
297         /sbin/chkconfig --del courier-pop3
298         %service courier-pop3-ssl stop
299         /sbin/chkconfig --del courier-pop3-ssl
300 fi
301
302 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.5
303 if [ -f /var/lib/openssl/certs/pop3d.pem ]; then
304         echo
305         echo pop3d.pem has been moved automatically to %{_certsdir}
306         echo
307         mv -f /var/lib/openssl/certs/pop3d.pem %{_certsdir}
308 fi
309 if [ -f /etc/sysconfig/courier-pop3 ]; then
310         . /etc/sysconfig/courier-pop3
311         for opt in `grep ^[^#] /etc/sysconfig/courier-pop3 |grep -v TLS_CERTFILE |grep -v MAILDIR |grep -v COURIERTLS |cut -d= -f1`;
312         do
313                 eval opt2=\$$opt
314                 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d
315                 sed -i s/^$opt=.*/"$opt=\"$opt2\""/ %{_sysconfdir}/pop3d-ssl
316         done
317         sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d-ssl
318         sed -i s!^MAILDIRPATH=.*!"MAILDIRPATH=\"$MAILDIR\""! %{_sysconfdir}/pop3d
319         echo
320         echo POP3D config file has been rewriten to %{_sysconfdir}/{pop3d,pop3d-ssl}
321         echo please look at them
322         echo
323 fi
324 %service courier-pop3 restart
325
326 %triggerin -n %{name}-pop3 -- %{name}-pop3 < 3.0.6
327 . %{_sysconfdir}/pop3d-ssl
328 if [ $TLS_CACHEFILE = "/var/couriersslcache" ]; then
329         sed -i s/^TLS_CACHEFILE=.*/"TLS_CACHEFILE=\/var\/spool\/courier-imap\/couriersslcache"/ %{_sysconfdir}/pop3d-ssl
330 fi
331
332 %files
333 %defattr(644,root,root,755)
334 %doc maildir/README.sharedfolders.txt imap/README.proxy tcpd/README.couriertls
335 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/imap
336 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.imap
337 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd
338 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd-ssl
339 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/imapd.cnf
340 %attr(754,root,root) /etc/rc.d/init.d/courier-imap
341 %attr(754,root,root) /etc/rc.d/init.d/courier-imap-ssl
342 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared
343 %attr(755,daemon,daemon) %dir %{_sysconfdir}/shared.tmp
344 %attr(644,daemon,daemon) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/shared/index
345 %attr(755,root,root) %{_bindir}/imapd
346 %attr(755,root,root) %{_bindir}/maildiracl
347 %attr(755,root,root) %{_bindir}/maildirkw
348 %attr(755,root,root) %{_sbindir}/imaplogin
349 %attr(755,root,root) %{_sbindir}/mkimapdcert
350 %attr(755,root,root) %{_sbindir}/sharedindexinstall
351 %attr(755,root,root) %{_sbindir}/sharedindexsplit
352 %attr(755,root,root) %{_libexecdir}/imapd.rc
353 %attr(755,root,root) %{_libexecdir}/imapd-ssl.rc
354 %{_mandir}/man8/imapd*
355 %{_mandir}/man1/maildiracl.1*
356 %{_mandir}/man1/maildirkw.1*
357
358 %files common
359 %defattr(644,root,root,755)
360 %doc AUTHORS ChangeLog imap/BUGS INSTALL README*
361 %attr(751,root,root) %dir %{_sysconfdir}
362 %attr(750,root,root) %dir %{_certsdir}
363 %attr(770,daemon,daemon) %dir %{_localstatedir}
364 %dir %{_libexecdir}
365 %{_sysconfdir}/quotawarnmsg.example
366 %attr(755,root,root) %{_bindir}/couriertls
367 %attr(755,root,root) %{_libexecdir}/couriertcpd
368 %{_mandir}/man1/couriert*
369 %{_mandir}/man8/couriert*
370 %{_mandir}/man8/mk*
371
372 %files deliverquota
373 %defattr(644,root,root,755)
374 %attr(755,root,root) %{_bindir}/deliverquota
375 %{_mandir}/man8/deliverquota*
376
377 %files maildirmake
378 %defattr(644,root,root,755)
379 %attr(755,root,root) %{_bindir}/maildirmake
380 %{_mandir}/man1/maildirmake*
381
382 %files pop3
383 %defattr(644,root,root,755)
384 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/pop3
385 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.pop3
386 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d
387 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d-ssl
388 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pop3d.cnf
389 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3
390 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3-ssl
391 %attr(755,root,root) %{_bindir}/pop3d
392 %attr(755,root,root) %{_sbindir}/mkpop3dcert
393 %attr(755,root,root) %{_sbindir}/pop3login
394 %attr(755,root,root) %{_libexecdir}/pop3d.rc
395 %attr(755,root,root) %{_libexecdir}/pop3d-ssl.rc
396 %{_mandir}/man8/courierpop*
This page took 0.05635 seconds and 4 git commands to generate.