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