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