]> git.pld-linux.org Git - packages/courier.git/blame - courier.spec
courier raw spec file taken from its distribution
[packages/courier.git] / courier.spec
CommitLineData
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
7Summary: Courier 0.26.20000822 mail server
8Name: courier
9Version: 0.26.20000822
10Release: 1%{courier_release}
11Copyright: GPL
12Group: Applications/Mail
13Source: courier-0.26.20000822.tar.gz
14Packager: %{PACKAGER}
15BuildRoot: /var/tmp/courier-install
16Provides: smtpdaemon
17AutoProv: no
18Requires: /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
47Summary: Courier 0.26.20000822 soft links for sendmail
48Group: Applications/Mail
49
50%package pop3d
51Summary: Courier 0.26.20000822 Integrated POP3 server
52Group: Applications/Mail
53Requires: courier = 0.26.20000822
54
55%package imapd
56Summary: Courier 0.26.20000822 Integrated IMAP server
57Group: Applications/Mail
58Requires: courier = 0.26.20000822
59Obsoletes: courier-imap
60
61%package webmail
62Summary: Courier 0.26.20000822 Integrated HTTP (webmail) server
63Group: Applications/Mail
64Requires: courier = 0.26.20000822 %{_cgibindir} %{_documentrootdir}
65
66%package mlm
67Summary: Courier 0.26.20000822 Integrated Mailing List Manager
68Group: Applications/Mail
69Requires: courier = 0.26.20000822
70
71%package maildrop
72Summary: Courier 0.26.20000822 Integrated mail filter
73Group: Applications/Mail
74Requires: courier = 0.26.20000822
75
76%package maildrop-wrapper
77Summary: Courier 0.26.20000822 soft links for maildrop
78Group: Applications/Mail
79Requires: courier-maildrop = 0.26.20000822
80
81%package smtpauth
82Summary: Courier 0.26.20000822 mail server authenticated ESMTP module
83Group: Applications/Mail
84Requires: courier = 0.26.20000822
85
86Summary: Courier
87%description
88Courier is a fully functional mail server, that can completely take
89over the mail services normally provided by sendmail, Qmail, or any
90other mail server. Although Courier does not support all legacy
91features of existing mail servers, the number of obsoleted functions
92is very small, and there are better, and more robust, alternatives
93available.
94
95Courier implements many SMTP extensions: DSN, PIPELINING, 8BITMIME.
96Courier also implements several new SMTP extensions for mailing list
97management and spam filtering.
98
99%description sendmail-wrapper
100This package contains two soft links from /usr/sbin/sendmail and
101/usr/lib/sendmail to %{_bindir}/sendmail. This allows application
102that use sendmail to transparently use Courier for sending mail.
103
104%description pop3d
105This package installs Courier mail server's integrated POP3 server,
106which allows you to download mail from your mailbox using any POP3
107client. Courier's POP3 server can only be used to download mail
108from maildir mailboxes. This server does not support mailbox files.
109If you do not need the ability to download your mail using a POP3
110client, you do not need to install this package.
111
112%description imapd
113This package installs Courier mail server's integrated IMAP server.
114If you do not need the ability to download your mail using an IMAP
115mail client, you do not need to install this package. Courier's
116IMAP server can only be used to download mail from maildir
117mailboxes. This server does not support mailbox files.
118
119This package requires that Courier must be already installed, this
120is NOT the standalone version of the Courier-IMAP server, and you
121cannot install both this package, and the standalone version of
122Courier-IMAP. If you have the standalone version of the
123Courier-IMAP server already installed, installing this package
124will automatically remove the standalone version.
125
126%description webmail
127This package installs Courier mail server's integrated HTTP webmail
128server. If you do not need the ability to access your mail using a
129web browser, you do not need to install this package. Courier's
130webmail server can only be used to download mail from maildir
131mailboxes. This server does not support mailbox files.
132
133This is the same server that's distributed separately under the
134name of SqWebMail, however its configuration is customized for the
135Courier mail server.
136
137%description maildrop
138This package installs Courier mail server's integrated mail filter.
139You need to install this package if you want to be able to filter
140your incoming mail.
141
142%description mlm
143This package installs couriermlm - a mailing list manager for the
144Courier mail server. If you do not need the ability to manage
145mailing lists, you do not need to install this package.
146
147couriermlm is used to set up, maintain, and run a mailing list.
148couriermlm automatically processes subscription and unsubscription
149requests, and removes undeliverable addresses from the subscription
150rolls. Mailing lists managed by couriermlm require zero human
151administrative oversight. couriermlm supports digests, write-only
152posting aliases, and moderated mailing lists.
153
154%description maildrop-wrapper
155This package installs several soft links from the /usr/local/bin
156directory to Courier's integrated maildrop mail filter. Maildrop is
157available as a standalone package, which installs in /usr/local/bin.
158If you have applications that expect to find maildrop in /usr/local/bin
159you can install this package to create soft links that point to
160Courier's integrated maildrop version instead, in order to continue
161to use those applications, without needing to reconfigure them.
162
163%description smtpauth
164Authenticated ESMTP allows remote users to authenticate themselves
165and 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
176cat >README.REDHAT <<EOF
177
178This installation of Courier is configured as follows:
179
180Installation directory: %{_prefix}
181Binary installation directory: %{_exec_prefix}
182Binaries: %{_bindir}
183Superuser binaries: %{_sbindir}
184Program executables: %{_libexecdir}
185Configuration files: %{_sysconfdir}
186Scripts, other non-binaries: %{_datadir}
187Mail queue, temporary files: %{_localstatedir}
188Manual pages: %{_mandir}
189
190EOF
191
192%build
193make
194make check
195%install
196
197umask 022
198test "$RPM_BUILD_ROOT" != "" && rm -rf $RPM_BUILD_ROOT
199mkdir -p $RPM_BUILD_ROOT%{_prefix}
200mkdir -p $RPM_BUILD_ROOT/etc/pam.d
201
202if test "%{_package_maintainer}" = "1"
203then
204 make install DESTDIR=$RPM_BUILD_ROOT
205else
206 make install-strip DESTDIR=$RPM_BUILD_ROOT
207fi
208
209ln -s %{_sysconfdir}/pop3d.authpam $RPM_BUILD_ROOT/etc/pam.d/pop3
210ln -s %{_sysconfdir}/esmtp.authpam $RPM_BUILD_ROOT/etc/pam.d/esmtp
211ln -s %{_sysconfdir}/imapd.authpam $RPM_BUILD_ROOT/etc/pam.d/imap
212ln -s %{_sysconfdir}/webmail.authpam $RPM_BUILD_ROOT/etc/pam.d/webmail
213
214make 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
221echo '/etc/pam.d/esmtp 644 root root' >>permissions.dat
222echo '/etc/profile.d/courier.sh 755 bin bin config' >>permissions.dat
223echo '/etc/profile.d/courier.csh 755 bin bin config' >>permissions.dat
224echo '%{initdir}/courier 755 bin bin config' >>permissions.dat
225
226#
227# Translate permissions.dat to spec file filelist.
228#
229
230perl -e '
231$buildroot=$ENV{"RPM_BUILD_ROOT"};
232$prefix="%{_prefix}";
233$exec_prefix="%{_exec_prefix}";
234
235while (<>)
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
281sed -n '/imap[\.a-z0-9]*$/p;/imapd-ssl/p' <filelist1 >filelist.imap
282sed -n '/pop3[\.a-z0-9]*$/p' <filelist1 >filelist.pop3
283sed -n '/couriermlm/p' <filelist1 >filelist.mlm
284sed -n '/authstart$/p;/authend$/p' <filelist1 >filelist.auth
285sed -n '/maildrop[^/]*$/p;/reformail[^/]*$/p;/reformime[^/]*$/p' <filelist1 >filelist.maildrop
286sed '/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
288sed -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
295mkdir -p $RPM_BUILD_ROOT%{_cgibindir}
296cp $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
301mkdir -p $RPM_BUILD_ROOT%{_documentrootdir}
302mv $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
306if test -f webmail/cron.cmd
307then
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
311fi
312
313#
314# Move .html documentation back to build dir, so that RPM will move it to
315# the appropriate docdir
316#
317
318rm -rf htmldoc
319mkdir htmldoc
320cp $RPM_BUILD_ROOT%{_datadir}/htmldoc/* htmldoc
321chmod 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
326sed 's/^POP3DSTART.*/POP3DSTART=YES/' <$RPM_BUILD_ROOT%{_sysconfdir}/pop3d >$RPM_BUILD_ROOT%{_sysconfdir}/pop3d.new
327mv $RPM_BUILD_ROOT%{_sysconfdir}/pop3d.new $RPM_BUILD_ROOT%{_sysconfdir}/pop3d
328
329sed 's/^IMAPDSTART.*/IMAPDSTART=YES/' <$RPM_BUILD_ROOT%{_sysconfdir}/imapd >$RPM_BUILD_ROOT%{_sysconfdir}/imapd.new
330mv $RPM_BUILD_ROOT%{_sysconfdir}/imapd.new $RPM_BUILD_ROOT%{_sysconfdir}/imapd
331
332sed 's/^IMAPDSSLSTART.*/IMAPDSSLSTART=YES/' <$RPM_BUILD_ROOT%{_sysconfdir}/imapd-ssl >$RPM_BUILD_ROOT%{_sysconfdir}/imapd.new-ssl
333mv $RPM_BUILD_ROOT%{_sysconfdir}/imapd.new-ssl $RPM_BUILD_ROOT%{_sysconfdir}/imapd-ssl
334
335#
336# Red Hat init.d file
337#
338
339mkdir -p $RPM_BUILD_ROOT%{initdir}
340
341cp courier.sysvinit $RPM_BUILD_ROOT%{initdir}/courier
342
343#
344# Red Hat /etc/profile.d scripts
345#
346
347mkdir -p $RPM_BUILD_ROOT/etc/profile.d
348cat >$RPM_BUILD_ROOT/etc/profile.d/courier.sh <<EOF
349if echo "\$PATH" | tr ':' '\012' | fgrep -qx %{_bindir}
350then
351 :
352else
353 if test -w /etc
354 then
355 PATH="%{_sbindir}:\$PATH"
356 fi
357 PATH="%{_bindir}:\$PATH"
358 export PATH
359fi
360EOF
361
362cat >$RPM_BUILD_ROOT/etc/profile.d/courier.csh <<EOF
363
364echo "\$PATH" | tr ':' '\012' | fgrep -qx %{_bindir}
365
366if ( \$? ) then
367 true
368else
369 test -w /etc
370 if ( \$? ) then
371 then
372 setenv PATH "%{_sbindir}:\$PATH"
373 endif
374 setenv PATH "%{_bindir}:\$PATH"
375endif
376EOF
377
378#
379# sendmail soft links
380#
381
382mkdir -p $RPM_BUILD_ROOT/usr/sbin
383mkdir -p $RPM_BUILD_ROOT/usr/lib
384mkdir -p $RPM_BUILD_ROOT/usr/bin
385
386ln -s %{_bindir}/sendmail $RPM_BUILD_ROOT/usr/sbin/sendmail
387ln -s %{_bindir}/sendmail $RPM_BUILD_ROOT/usr/lib/sendmail
388ln -s %{_bindir}/sendmail $RPM_BUILD_ROOT/usr/bin/sendmail
389
390#
391# maildrop wrapper soft links
392#
393
394mkdir -p $RPM_BUILD_ROOT/usr/local/bin
395
396for f in dotlock maildirmake maildrop makedat reformail reformime deliverquota
397do
398 ln -s %{_bindir}/$f $RPM_BUILD_ROOT/usr/local/bin/$f
399done
400
401for f in makeuserdb pw2userdb userdb userdbpw vchkpw2userdb
402do
403 ln -s %{_sbindir}/$f $RPM_BUILD_ROOT/usr/local/bin/$f
404done
405
406#
407# The following directories are not created by default, but I want them here.
408#
409
410mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/userdb
411mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/tmp/broken
412
413. courier/uidgid || exit 1
414
415mailuser=daemon
416mailgroup=daemon
417
418echo "%attr(700, $mailuser, $mailgroup) %dir %{_sysconfdir}/userdb" >>filelist
419echo "%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
429if test ! -f %{_datadir}/esmtpd.pem
430then
431 %{_sbindir}/mkesmtpdcert
432fi
433
434%preun
435%{initdir}/courier stop
436if test "$1" = "0"
437then
438 /sbin/chkconfig --del courier
439fi
440
441%post imapd
442# If we do not have a certificate, make one up.
443
444if test ! -f %{_datadir}/imapd.pem
445then
446 %{_sbindir}/mkimapdcert
447fi
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
496rm -rf $RPM_BUILD_ROOT
This page took 0.127748 seconds and 4 git commands to generate.