]>
Commit | Line | Data |
---|---|---|
c5ebe9bf | 1 | # |
2 | # Need to version-upgrade RH builds due to different directory locations. | |
3 | # | |
4 | ||
5 | %define courier_release %(release="`rpm -q --queryformat='.%{VERSION}' redhat-release 2>/dev/null`" ; echo "$release") | |
6 | ||
7 | Summary: Courier 0.26.20000822 mail server | |
8 | Name: courier | |
9 | Version: 0.26.20000822 | |
10 | Release: 1%{courier_release} | |
11 | Copyright: GPL | |
12 | Group: Applications/Mail | |
13 | Source: courier-0.26.20000822.tar.gz | |
14 | Packager: %{PACKAGER} | |
15 | BuildRoot: /var/tmp/courier-install | |
16 | Provides: smtpdaemon | |
17 | AutoProv: no | |
18 | Requires: /sbin/chkconfig | |
19 | ||
20 | # | |
21 | # RH custom locations. | |
22 | # | |
23 | # <7.X 7.x | |
24 | # manpages /usr/man /usr/share/man | |
25 | # httpd /home/httpd /var/www | |
26 | # initscripts /etc/rc.d/init.d /etc/init.d | |
27 | ||
28 | %{expand:%%define manpagedir %(if test -d %{_prefix}/share/man ; then echo %{_prefix}/share/man ; else echo %{_prefix}/man ; fi)} | |
29 | ||
30 | %define apachedir %(if test -d /var/www ; then echo /var/www ; else echo /home/httpd ; fi) | |
31 | ||
32 | %define _prefix /usr/lib/courier | |
33 | %define _localstatedir /var/spool/courier | |
34 | %define _sysconfdir /etc/courier | |
35 | %define _mandir %{manpagedir} | |
36 | ||
37 | %define initdir %(if test -d /etc/init.d/. ; then echo /etc/init.d ; else echo /etc/rc.d/init.d ; fi) | |
38 | ||
39 | # Change the following if your DocumentRoot and cgibindir differ. This is | |
40 | # the default redhat build: | |
41 | ||
42 | %define _cgibindir %{apachedir}/cgi-bin | |
43 | %define _documentrootdir %{apachedir}/html | |
44 | %define _imageurl /webmail/ | |
45 | ||
46 | %package sendmail-wrapper | |
47 | Summary: Courier 0.26.20000822 soft links for sendmail | |
48 | Group: Applications/Mail | |
49 | ||
50 | %package pop3d | |
51 | Summary: Courier 0.26.20000822 Integrated POP3 server | |
52 | Group: Applications/Mail | |
53 | Requires: courier = 0.26.20000822 | |
54 | ||
55 | %package imapd | |
56 | Summary: Courier 0.26.20000822 Integrated IMAP server | |
57 | Group: Applications/Mail | |
58 | Requires: courier = 0.26.20000822 | |
59 | Obsoletes: courier-imap | |
60 | ||
61 | %package webmail | |
62 | Summary: Courier 0.26.20000822 Integrated HTTP (webmail) server | |
63 | Group: Applications/Mail | |
64 | Requires: courier = 0.26.20000822 %{_cgibindir} %{_documentrootdir} | |
65 | ||
66 | %package mlm | |
67 | Summary: Courier 0.26.20000822 Integrated Mailing List Manager | |
68 | Group: Applications/Mail | |
69 | Requires: courier = 0.26.20000822 | |
70 | ||
71 | %package maildrop | |
72 | Summary: Courier 0.26.20000822 Integrated mail filter | |
73 | Group: Applications/Mail | |
74 | Requires: courier = 0.26.20000822 | |
75 | ||
76 | %package maildrop-wrapper | |
77 | Summary: Courier 0.26.20000822 soft links for maildrop | |
78 | Group: Applications/Mail | |
79 | Requires: courier-maildrop = 0.26.20000822 | |
80 | ||
81 | %package smtpauth | |
82 | Summary: Courier 0.26.20000822 mail server authenticated ESMTP module | |
83 | Group: Applications/Mail | |
84 | Requires: courier = 0.26.20000822 | |
85 | ||
86 | Summary: Courier | |
87 | %description | |
88 | Courier is a fully functional mail server, that can completely take | |
89 | over the mail services normally provided by sendmail, Qmail, or any | |
90 | other mail server. Although Courier does not support all legacy | |
91 | features of existing mail servers, the number of obsoleted functions | |
92 | is very small, and there are better, and more robust, alternatives | |
93 | available. | |
94 | ||
95 | Courier implements many SMTP extensions: DSN, PIPELINING, 8BITMIME. | |
96 | Courier also implements several new SMTP extensions for mailing list | |
97 | management and spam filtering. | |
98 | ||
99 | %description sendmail-wrapper | |
100 | This package contains two soft links from /usr/sbin/sendmail and | |
101 | /usr/lib/sendmail to %{_bindir}/sendmail. This allows application | |
102 | that use sendmail to transparently use Courier for sending mail. | |
103 | ||
104 | %description pop3d | |
105 | This package installs Courier mail server's integrated POP3 server, | |
106 | which allows you to download mail from your mailbox using any POP3 | |
107 | client. Courier's POP3 server can only be used to download mail | |
108 | from maildir mailboxes. This server does not support mailbox files. | |
109 | If you do not need the ability to download your mail using a POP3 | |
110 | client, you do not need to install this package. | |
111 | ||
112 | %description imapd | |
113 | This package installs Courier mail server's integrated IMAP server. | |
114 | If you do not need the ability to download your mail using an IMAP | |
115 | mail client, you do not need to install this package. Courier's | |
116 | IMAP server can only be used to download mail from maildir | |
117 | mailboxes. This server does not support mailbox files. | |
118 | ||
119 | This package requires that Courier must be already installed, this | |
120 | is NOT the standalone version of the Courier-IMAP server, and you | |
121 | cannot install both this package, and the standalone version of | |
122 | Courier-IMAP. If you have the standalone version of the | |
123 | Courier-IMAP server already installed, installing this package | |
124 | will automatically remove the standalone version. | |
125 | ||
126 | %description webmail | |
127 | This package installs Courier mail server's integrated HTTP webmail | |
128 | server. If you do not need the ability to access your mail using a | |
129 | web browser, you do not need to install this package. Courier's | |
130 | webmail server can only be used to download mail from maildir | |
131 | mailboxes. This server does not support mailbox files. | |
132 | ||
133 | This is the same server that's distributed separately under the | |
134 | name of SqWebMail, however its configuration is customized for the | |
135 | Courier mail server. | |
136 | ||
137 | %description maildrop | |
138 | This package installs Courier mail server's integrated mail filter. | |
139 | You need to install this package if you want to be able to filter | |
140 | your incoming mail. | |
141 | ||
142 | %description mlm | |
143 | This package installs couriermlm - a mailing list manager for the | |
144 | Courier mail server. If you do not need the ability to manage | |
145 | mailing lists, you do not need to install this package. | |
146 | ||
147 | couriermlm is used to set up, maintain, and run a mailing list. | |
148 | couriermlm automatically processes subscription and unsubscription | |
149 | requests, and removes undeliverable addresses from the subscription | |
150 | rolls. Mailing lists managed by couriermlm require zero human | |
151 | administrative oversight. couriermlm supports digests, write-only | |
152 | posting aliases, and moderated mailing lists. | |
153 | ||
154 | %description maildrop-wrapper | |
155 | This package installs several soft links from the /usr/local/bin | |
156 | directory to Courier's integrated maildrop mail filter. Maildrop is | |
157 | available as a standalone package, which installs in /usr/local/bin. | |
158 | If you have applications that expect to find maildrop in /usr/local/bin | |
159 | you can install this package to create soft links that point to | |
160 | Courier's integrated maildrop version instead, in order to continue | |
161 | to use those applications, without needing to reconfigure them. | |
162 | ||
163 | %description smtpauth | |
164 | Authenticated ESMTP allows remote users to authenticate themselves | |
165 | and be able to relay outbound mail through the Courier mail server. | |
166 | ||
167 | %prep | |
168 | %setup | |
169 | ||
170 | %{configure} \ | |
171 | --localstatedir=%{_localstatedir} \ | |
172 | --sysconfdir=%{_sysconfdir} \ | |
173 | --mandir=%{_mandir} \ | |
174 | --enable-imageurl=%{_imageurl} | |
175 | ||
176 | cat >README.REDHAT <<EOF | |
177 | ||
178 | This installation of Courier is configured as follows: | |
179 | ||
180 | Installation directory: %{_prefix} | |
181 | Binary installation directory: %{_exec_prefix} | |
182 | Binaries: %{_bindir} | |
183 | Superuser binaries: %{_sbindir} | |
184 | Program executables: %{_libexecdir} | |
185 | Configuration files: %{_sysconfdir} | |
186 | Scripts, other non-binaries: %{_datadir} | |
187 | Mail queue, temporary files: %{_localstatedir} | |
188 | Manual pages: %{_mandir} | |
189 | ||
190 | EOF | |
191 | ||
192 | %build | |
193 | make | |
194 | make check | |
195 | %install | |
196 | ||
197 | umask 022 | |
198 | test "$RPM_BUILD_ROOT" != "" && rm -rf $RPM_BUILD_ROOT | |
199 | mkdir -p $RPM_BUILD_ROOT%{_prefix} | |
200 | mkdir -p $RPM_BUILD_ROOT/etc/pam.d | |
201 | ||
202 | if test "%{_package_maintainer}" = "1" | |
203 | then | |
204 | make install DESTDIR=$RPM_BUILD_ROOT | |
205 | else | |
206 | make install-strip DESTDIR=$RPM_BUILD_ROOT | |
207 | fi | |
208 | ||
209 | ln -s %{_sysconfdir}/pop3d.authpam $RPM_BUILD_ROOT/etc/pam.d/pop3 | |
210 | ln -s %{_sysconfdir}/esmtp.authpam $RPM_BUILD_ROOT/etc/pam.d/esmtp | |
211 | ln -s %{_sysconfdir}/imapd.authpam $RPM_BUILD_ROOT/etc/pam.d/imap | |
212 | ln -s %{_sysconfdir}/webmail.authpam $RPM_BUILD_ROOT/etc/pam.d/webmail | |
213 | ||
214 | make install-perms | |
215 | ||
216 | # | |
217 | # We're going to create some more config files later, so let's just make | |
218 | # sure they're processed as all other Courier config files | |
219 | # | |
220 | ||
221 | echo '/etc/pam.d/esmtp 644 root root' >>permissions.dat | |
222 | echo '/etc/profile.d/courier.sh 755 bin bin config' >>permissions.dat | |
223 | echo '/etc/profile.d/courier.csh 755 bin bin config' >>permissions.dat | |
224 | echo '%{initdir}/courier 755 bin bin config' >>permissions.dat | |
225 | ||
226 | # | |
227 | # Translate permissions.dat to spec file filelist. | |
228 | # | |
229 | ||
230 | perl -e ' | |
231 | $buildroot=$ENV{"RPM_BUILD_ROOT"}; | |
232 | $prefix="%{_prefix}"; | |
233 | $exec_prefix="%{_exec_prefix}"; | |
234 | ||
235 | while (<>) | |
236 | { | |
237 | chop if /\n$/; | |
238 | ($file,$mode,$uid,$gid,$special)=split(/ +/); | |
239 | $file=$prefix if $file eq "$prefix/."; | |
240 | ||
241 | next if $special eq "doc"; | |
242 | next if $file eq "$prefix/doc"; | |
243 | ||
244 | # Ignore dir/. entries | |
245 | ||
246 | next if $file =~ /\/\.$/; | |
247 | ||
248 | # Ignore man directories | |
249 | ||
250 | next if $file eq "%{_mandir}"; | |
251 | next if substr($file, 0, length("%{_mandir}")) eq "%{_mandir}" | |
252 | && substr($file, length("%{_mandir}")) =~ /^\/man[1-9]$/; | |
253 | ||
254 | $mode = "-" if $special eq "%doc"; | |
255 | $special="%config" if $special eq "config"; | |
256 | $special="%dir" if ! -l "$buildroot/$file" && -d "$buildroot/$file"; | |
257 | if ($special eq "man") | |
258 | { | |
259 | if ( -l "$buildroot/$file" ) | |
260 | { | |
261 | print STDERR "ln -s " . readlink("$buildroot$file") | |
262 | . ".gz $buildroot/$file.gz\n"; | |
263 | symlink readlink("$buildroot$file") | |
264 | . ".gz", "$buildroot/$file.gz"; | |
265 | } | |
266 | else | |
267 | { | |
268 | print STDERR "gzip <$buildroot$file >$buildroot$file.gz\n"; | |
269 | system("gzip <$buildroot$file >$buildroot$file.gz ; rm -f $buildroot$file"); | |
270 | } | |
271 | $file="$file.gz" | |
272 | } | |
273 | $special="" unless $special =~ /%/; | |
274 | ||
275 | $special="%attr($mode, $uid, $gid) $special"; | |
276 | print "$special $file\n"; | |
277 | } | |
278 | ||
279 | ' <permissions.dat >filelist1 || exit 1 | |
280 | ||
281 | sed -n '/imap[\.a-z0-9]*$/p;/imapd-ssl/p' <filelist1 >filelist.imap | |
282 | sed -n '/pop3[\.a-z0-9]*$/p' <filelist1 >filelist.pop3 | |
283 | sed -n '/couriermlm/p' <filelist1 >filelist.mlm | |
284 | sed -n '/authstart$/p;/authend$/p' <filelist1 >filelist.auth | |
285 | sed -n '/maildrop[^/]*$/p;/reformail[^/]*$/p;/reformime[^/]*$/p' <filelist1 >filelist.maildrop | |
286 | sed '/imap[\.a-z0-9]*$/d;/imapd-ssl/d;/pop3[\.a-z0-9]*$/d;/couriermlm/d;/webmail/d;/ldapaddressbook$/d;/maildrop[^/]*$/d;/reformail[^/]*$/d;/reformime[^/]*$/d;/authstart$/d;/authend$/d' <filelist1 >filelist | |
287 | ||
288 | sed -n '/sqwebmail/p;/webmail.authpam/p;/webmail-logincache/p;/ldapaddressbook$/p' <filelist1 | sed '/images/d' >filelist.webmail | |
289 | ||
290 | # Note that we delete all 'webmail's, but copy over only 'sqwebmail's. | |
291 | # This removes all webmail-related stuff from the main filelist, | |
292 | # and adds everything except the executable, webmail, to filelist.webmail. | |
293 | # Here's why: | |
294 | ||
295 | mkdir -p $RPM_BUILD_ROOT%{_cgibindir} | |
296 | cp $RPM_BUILD_ROOT%{_libexecdir}/courier/webmail/webmail \ | |
297 | $RPM_BUILD_ROOT%{_cgibindir}/webmail | |
298 | ||
299 | # And here's why we delete all images from filelist.webmail: | |
300 | ||
301 | mkdir -p $RPM_BUILD_ROOT%{_documentrootdir} | |
302 | mv $RPM_BUILD_ROOT%{_datadir}/sqwebmail/images $RPM_BUILD_ROOT%{_documentrootdir}/webmail | |
303 | ||
304 | # Do we need to install a cron job to clean out webmail's cache? | |
305 | ||
306 | if test -f webmail/cron.cmd | |
307 | then | |
308 | mkdir -p $RPM_BUILD_ROOT/etc/cron.hourly | |
309 | cp webmail/cron.cmd $RPM_BUILD_ROOT/etc/cron.hourly/courier-webmail-cleancache | |
310 | echo "%attr(555, root, wheel) /etc/cron.hourly/courier-webmail-cleancache" >>filelist.webmail | |
311 | fi | |
312 | ||
313 | # | |
314 | # Move .html documentation back to build dir, so that RPM will move it to | |
315 | # the appropriate docdir | |
316 | # | |
317 | ||
318 | rm -rf htmldoc | |
319 | mkdir htmldoc | |
320 | cp $RPM_BUILD_ROOT%{_datadir}/htmldoc/* htmldoc | |
321 | chmod a-w htmldoc/* | |
322 | ||
323 | # Manually set POP3DSTART and IMAPDSTART to yes, they'll go into a separate | |
324 | # package, so after it's installed they should be runnable. | |
325 | ||
326 | sed 's/^POP3DSTART.*/POP3DSTART=YES/' <$RPM_BUILD_ROOT%{_sysconfdir}/pop3d >$RPM_BUILD_ROOT%{_sysconfdir}/pop3d.new | |
327 | mv $RPM_BUILD_ROOT%{_sysconfdir}/pop3d.new $RPM_BUILD_ROOT%{_sysconfdir}/pop3d | |
328 | ||
329 | sed 's/^IMAPDSTART.*/IMAPDSTART=YES/' <$RPM_BUILD_ROOT%{_sysconfdir}/imapd >$RPM_BUILD_ROOT%{_sysconfdir}/imapd.new | |
330 | mv $RPM_BUILD_ROOT%{_sysconfdir}/imapd.new $RPM_BUILD_ROOT%{_sysconfdir}/imapd | |
331 | ||
332 | sed 's/^IMAPDSSLSTART.*/IMAPDSSLSTART=YES/' <$RPM_BUILD_ROOT%{_sysconfdir}/imapd-ssl >$RPM_BUILD_ROOT%{_sysconfdir}/imapd.new-ssl | |
333 | mv $RPM_BUILD_ROOT%{_sysconfdir}/imapd.new-ssl $RPM_BUILD_ROOT%{_sysconfdir}/imapd-ssl | |
334 | ||
335 | # | |
336 | # Red Hat init.d file | |
337 | # | |
338 | ||
339 | mkdir -p $RPM_BUILD_ROOT%{initdir} | |
340 | ||
341 | cp courier.sysvinit $RPM_BUILD_ROOT%{initdir}/courier | |
342 | ||
343 | # | |
344 | # Red Hat /etc/profile.d scripts | |
345 | # | |
346 | ||
347 | mkdir -p $RPM_BUILD_ROOT/etc/profile.d | |
348 | cat >$RPM_BUILD_ROOT/etc/profile.d/courier.sh <<EOF | |
349 | if echo "\$PATH" | tr ':' '\012' | fgrep -qx %{_bindir} | |
350 | then | |
351 | : | |
352 | else | |
353 | if test -w /etc | |
354 | then | |
355 | PATH="%{_sbindir}:\$PATH" | |
356 | fi | |
357 | PATH="%{_bindir}:\$PATH" | |
358 | export PATH | |
359 | fi | |
360 | EOF | |
361 | ||
362 | cat >$RPM_BUILD_ROOT/etc/profile.d/courier.csh <<EOF | |
363 | ||
364 | echo "\$PATH" | tr ':' '\012' | fgrep -qx %{_bindir} | |
365 | ||
366 | if ( \$? ) then | |
367 | true | |
368 | else | |
369 | test -w /etc | |
370 | if ( \$? ) then | |
371 | then | |
372 | setenv PATH "%{_sbindir}:\$PATH" | |
373 | endif | |
374 | setenv PATH "%{_bindir}:\$PATH" | |
375 | endif | |
376 | EOF | |
377 | ||
378 | # | |
379 | # sendmail soft links | |
380 | # | |
381 | ||
382 | mkdir -p $RPM_BUILD_ROOT/usr/sbin | |
383 | mkdir -p $RPM_BUILD_ROOT/usr/lib | |
384 | mkdir -p $RPM_BUILD_ROOT/usr/bin | |
385 | ||
386 | ln -s %{_bindir}/sendmail $RPM_BUILD_ROOT/usr/sbin/sendmail | |
387 | ln -s %{_bindir}/sendmail $RPM_BUILD_ROOT/usr/lib/sendmail | |
388 | ln -s %{_bindir}/sendmail $RPM_BUILD_ROOT/usr/bin/sendmail | |
389 | ||
390 | # | |
391 | # maildrop wrapper soft links | |
392 | # | |
393 | ||
394 | mkdir -p $RPM_BUILD_ROOT/usr/local/bin | |
395 | ||
396 | for f in dotlock maildirmake maildrop makedat reformail reformime deliverquota | |
397 | do | |
398 | ln -s %{_bindir}/$f $RPM_BUILD_ROOT/usr/local/bin/$f | |
399 | done | |
400 | ||
401 | for f in makeuserdb pw2userdb userdb userdbpw vchkpw2userdb | |
402 | do | |
403 | ln -s %{_sbindir}/$f $RPM_BUILD_ROOT/usr/local/bin/$f | |
404 | done | |
405 | ||
406 | # | |
407 | # The following directories are not created by default, but I want them here. | |
408 | # | |
409 | ||
410 | mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/userdb | |
411 | mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/tmp/broken | |
412 | ||
413 | . courier/uidgid || exit 1 | |
414 | ||
415 | mailuser=daemon | |
416 | mailgroup=daemon | |
417 | ||
418 | echo "%attr(700, $mailuser, $mailgroup) %dir %{_sysconfdir}/userdb" >>filelist | |
419 | echo "%attr(755, $mailuser, $mailgroup) %dir %{_localstatedir}/tmp/broken" >>filelist | |
420 | ||
421 | %post | |
422 | /sbin/chkconfig --del courier | |
423 | /sbin/chkconfig --add courier | |
424 | %{_sbindir}/makealiases 2>/dev/null || true | |
425 | %{_sbindir}/makesmtpaccess 2>/dev/null || true | |
426 | ||
427 | # If we do not have a certificate, make one up. | |
428 | ||
429 | if test ! -f %{_datadir}/esmtpd.pem | |
430 | then | |
431 | %{_sbindir}/mkesmtpdcert | |
432 | fi | |
433 | ||
434 | %preun | |
435 | %{initdir}/courier stop | |
436 | if test "$1" = "0" | |
437 | then | |
438 | /sbin/chkconfig --del courier | |
439 | fi | |
440 | ||
441 | %post imapd | |
442 | # If we do not have a certificate, make one up. | |
443 | ||
444 | if test ! -f %{_datadir}/imapd.pem | |
445 | then | |
446 | %{_sbindir}/mkimapdcert | |
447 | fi | |
448 | %preun imapd | |
449 | %{_sbindir}/imapd stop | |
450 | %{_sbindir}/imapd-ssl stop | |
451 | ||
452 | %preun pop3d | |
453 | %{_sbindir}/pop3d stop | |
454 | ||
455 | %post smtpauth | |
456 | %{_sbindir}/esmtpd stop | |
457 | %{_sbindir}/esmtpd start | |
458 | ||
459 | %postun smtpauth | |
460 | %{_sbindir}/esmtpd stop | |
461 | %{_sbindir}/esmtpd start | |
462 | ||
463 | %files -f filelist | |
464 | ||
465 | %attr(555, bin, bin) %doc README.REDHAT AUTHORS COPYING | |
466 | %attr(555, bin, bin) %doc htmldoc/* | |
467 | ||
468 | %files sendmail-wrapper | |
469 | %attr(-, bin, bin) /usr/sbin/sendmail | |
470 | %attr(-, bin, bin) /usr/bin/sendmail | |
471 | %attr(-, bin, bin) /usr/lib/sendmail | |
472 | ||
473 | %files maildrop-wrapper | |
474 | ||
475 | %attr(-, bin, bin) /usr/local/bin/* | |
476 | ||
477 | %files pop3d -f filelist.pop3 | |
478 | %attr(644, root, wheel) /etc/pam.d/pop3 | |
479 | ||
480 | %files imapd -f filelist.imap | |
481 | %attr(644, root, wheel) /etc/pam.d/imap | |
482 | ||
483 | %files webmail -f filelist.webmail | |
484 | %attr(4511, root, wheel) %{_cgibindir}/webmail | |
485 | %attr(644, root, wheel) /etc/pam.d/webmail | |
486 | %attr(755, bin, bin) %dir %{_documentrootdir}/webmail | |
487 | %attr(444, bin, bin) %{_documentrootdir}/webmail/* | |
488 | ||
489 | %files maildrop -f filelist.maildrop | |
490 | ||
491 | %files mlm -f filelist.mlm | |
492 | ||
493 | %files smtpauth -f filelist.auth | |
494 | ||
495 | %clean | |
496 | rm -rf $RPM_BUILD_ROOT |