/[packages]/cauldron/postfix/current/SPECS/postfix.spec
ViewVC logotype

Contents of /cauldron/postfix/current/SPECS/postfix.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 394770 - (show annotations) (download)
Wed Feb 6 00:42:00 2013 UTC (11 years, 2 months ago) by luigiwalser
File size: 29498 byte(s)
2.9.6
1 # compatibility macros
2
3 # Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
4 %define defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
5 %define undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
6
7 # Shorthand for %{defined with_...}
8 %define with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
9 %define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
10
11 # useful in descriptions
12 %define with_TXT() %{expand:%%{?with_%{1}:with %{1}}%%{!?with_%{1}:without %{1}}}
13
14 # use bcond_with if default is disabled
15 # use bcond_without if default is enabled
16 %define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
17 %define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
18
19 # Disabled if official version, enabled if snapshot
20 %bcond_with experimental
21
22 # call package postfix-experimental?
23 # it cannot be parallel installed anyway
24 %if %{with experimental}
25 %bcond_without parallel
26 %else
27 %bcond_with parallel
28 %endif
29
30 %define pname postfix
31 %define pver 2.9.6
32 # from src/global/mail_version.h
33 %define releasedate 20130203
34 %define rel 1
35
36 %if ! %{with experimental}
37 %define distver %pver
38 %define distverdot %pver
39 %define ftp_directory official
40 %else
41 %define distver %pver-%releasedate
42 %define distverdot %pver.%releasedate
43 %define ftp_directory experimental
44 %endif
45
46 %define alternatives 1
47 %if %alternatives
48 %define sendmail_command %{_sbindir}/sendmail.postfix
49 %else
50 %define sendmail_command %{_sbindir}/sendmail
51 %endif
52 %define post_install_parameters daemon_directory=%{_libdir}/postfix command_directory=%{_sbindir} queue_directory=%{queue_directory} sendmail_path=%{sendmail_command} newaliases_path=%{_bindir}/newaliases mailq_path=%{_bindir}/mailq mail_owner=postfix setgid_group=%{maildrop_group} manpage_directory=%{_mandir} readme_directory=%{_docdir}/%name/README_FILES html_directory=%{_docdir}/%name/html data_directory=/var/lib/postfix
53
54 # use bcond_with if default is disabled
55 # use bcond_without if default is enabled
56 %bcond_without dynamicmaps
57
58 %bcond_without ldap
59 %bcond_without mysql
60 %bcond_without pgsql
61 %bcond_without sqlite
62 %bcond_without pcre
63 %bcond_without sasl
64 %bcond_without tls
65 %bcond_without ipv6
66 %bcond_without cdb
67 %bcond_with multiline
68 %bcond_with VDA
69 %bcond_without chroot
70
71 # Postfix requires one exlusive uid/gid and a 2nd exclusive gid for its own use.
72 %define maildrop_group postdrop
73 %define queue_directory %{_var}/spool/postfix
74
75 %if %{with dynamicmaps}
76 # if we are building dynamicmaps optional maps will always be built
77 %global with_ldap 1
78 %global with_mysql 1
79 %global with_pgsql 1
80 %global with_sqlite 1
81 %global with_pcre 1
82 %global with_cdb 1
83
84 # Macro: %{dynmap_add_cmd <name> [<soname>] [-m]}
85 %define dynmap_add_cmd(m) FILE=%{_sysconfdir}/postfix/dynamicmaps.cf; if ! grep -q "^%{1}[[:space:]]" ${FILE}; then echo "%{1} %{_libdir}/postfix/dict_%{?2:%{2}}%{?!2:%{1}}.so dict_%{1}_open%{-m: mkmap_%{1}_open}" >> ${FILE}; fi;
86 %define dynmap_rm_cmd() FILE=%{_sysconfdir}/postfix/dynamicmaps.cf; if [ $1 = 0 -a -s $FILE ]; then cp -p ${FILE} ${FILE}.$$; grep -v "^%{1}[[:space:]]" ${FILE}.$$ > ${FILE}; rm -f ${FILE}.$$; fi;
87 %endif
88
89 %if ! %{with parallel}
90 Name: %{pname}
91 Version: %{distverdot}
92 Release: %mkrel %{rel}
93 Conflicts: %{pname}-experimental
94 %else
95 Name: %{pname}-experimental
96 Version: %{pver}
97 Release: %mkrel -c %{releasedate} %{rel}
98 Provides: %{pname}
99 Conflicts: %{pname}
100 %endif
101 Summary: Postfix Mail Transport Agent
102 Epoch: 1
103 URL: http://www.postfix.org/
104 Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/%{ftp_directory}/%{pname}-%{distver}.tar.gz
105 Source1: ftp://ftp.porcupine.org/mirrors/postfix-release/%{ftp_directory}/%{pname}-%{distver}.tar.gz.sig
106 Source2: postfix-main.cf
107 Source3: postfix-etc-init.d-postfix
108 Source4: postfix-etc-pam.d-smtp
109 Source5: postfix-aliases
110 Source6: postfix-ip-up
111 Source7: postfix-ip-down
112 Source8: postfix-ifup-d
113 Source10: postfix-README.MGA
114 #Source11: postfix-README.MGA.update
115 #Source11: http://www.comedia.it/~bluca/postfix/CYRUS_README
116 Source12: postfix-bash-completion
117 Source13: http://www.seaglass.com/postfix/faq.html
118 Source14: postfix-chroot.sh
119 Source15: postfix-smtpd.conf
120 Source16: postfix-syslog-ng.200900.conf
121 Source17: postfix-syslog-ng.conf
122
123 # Simon J. Mudd stuff
124 Source21: ftp://ftp.wl0.org/postfinger/postfinger-1.30
125
126 # Jim Seymour stuff
127 Source25: http://jimsun.LinxNet.com/misc/postfix-anti-UCE.txt
128 Source26: http://jimsun.LinxNet.com/misc/header_checks.txt
129 Source27: http://jimsun.LinxNet.com/misc/body_checks.txt
130
131 # Dynamic map patch taken from debian's package
132 Patch0: postfix-2.9.1-dynamicmaps.diff
133
134 Patch1: postfix-2.9.5-mgaconfig.diff
135 Patch2: postfix-alternatives-mdk.patch
136
137 # dbupgrade patch patch split from dynamicmaps one
138 Patch3: postfix-2.9.1-dbupgrade.diff
139
140 # sdbm patch patch split from dynamicmaps one
141 Patch4: postfix-2.7.0-sdbm.patch
142
143 # missing dynamicmaps.cf file after updating P0
144 Patch5: postfix-2.9.1-dynamicmaps2.diff
145
146 # Shamelessy stolen from debian
147 Patch6: postfix-2.2.4-smtpstone.patch
148
149 # applied if %with pam
150 # originally from http://d.scn.ru/proj/postfix/dict_pam/
151 Patch7: postfix-2.0.16-20030921.pam.patch
152
153 # applied if %with multiline
154 Patch8: ftp://ftp.wl0.org/SOURCES/postfix-2.3.2-multiline-greeting.patch
155
156 # applied if %with VDA
157 # http://vda.sourceforge.net/
158 # Postfix 2.6.5-NG: SHASUM 946770cdfe2d77a96c6652b254449ea961513081
159 Patch9: http://vda.sourceforge.net/VDA/postfix-2.6.5-vda-ng.patch.gz
160 # Postfix 2.6.5-NG-bigquota: SHASUM 6dfeb9a2fff44d85e9a5a28b81a84898734adfe6
161 Patch10: http://vda.sourceforge.net/VDA/postfix-2.6.5-vda-ng-bigquota.patch.gz
162
163 License: IBM Public License
164 Group: System/Servers
165 Provides: mail-server
166 Provides: sendmail-command
167 # http://archives.mandrivalinux.com/cooker/2005-06/msg01987.php
168 Requires(post): chkconfig, initscripts, syslog-daemon, coreutils, diffutils, gawk
169 Requires: syslog-daemon, coreutils, diffutils, gawk
170 Requires(pre,post,postun,preun): rpm-helper >= 0.3
171 Requires(pre,post): sed
172 Requires: sed
173 Requires(post): openssl
174 %if %alternatives
175 Requires(post,preun): update-alternatives
176 %else
177 Conflicts: sendmail exim qmail
178 %endif
179 BuildRequires: db-devel, gawk, perl-base, sed
180 BuildRequires: html2text
181 %if %{with sasl}
182 BuildRequires: libsasl-devel >= 2.0
183 %endif
184
185 %if %{with tls}
186 BuildRequires: openssl-devel >= 0.9.7
187 %endif
188
189 %if %{with dynamicmaps}
190 %define libname %mklibname postfix 1
191 Requires: %{libname} = %epoch:%version-%release
192 Requires(post): %{libname} = %epoch:%version-%release
193 # versionless require or we will break upgrades
194 Requires(preun): %{libname}
195 # we dont, actually
196 Requires(postun): %{libname}
197 %else
198 %if %{with ldap}
199 BuildRequires: openldap-devel >= 2.1
200 %endif
201 %if %{with pcre}
202 BuildRequires: pcre-devel
203 %endif
204 %if %{with mysql}
205 BuildRequires: mariadb-devel
206 %endif
207 %if %{with pgsql}
208 BuildRequires: postgresql-devel >= 8.1.4
209 %endif
210 %if %{with sqlite}
211 BuildRequires: sqlite3-devel
212 %endif
213 %if %{with pam}
214 BuildRequires: pam-devel
215 %endif
216 %if %{with cdb}
217 BuildRequires: libtinycdb-devel
218 %endif
219 %endif
220 # dynamicmaps
221
222 %description
223 Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL),
224 TLS and running in a chroot environment.
225
226 Postfix is Wietse Venema's mailer that started life as an alternative
227 to the widely-used Sendmail program.
228 Postfix attempts to be fast, easy to administer, and secure, while at
229 the same time being sendmail compatible enough to not upset existing
230 users. Thus, the outside has a sendmail-ish flavor, but the inside is
231 completely different.
232 This software was formerly known as VMailer. It was released by the end
233 of 1998 as the IBM Secure Mailer. From then on it has lived on as Postfix.
234
235 This rpm supports different build time options, to enable or disable these
236 features you must rebuild the source rpm using the --with ... or --without ...
237 rpm option.
238 Currently postfix has been built with:
239
240 Smtpd multiline greeting: --%{with_TXT multiline}
241 Virtual Delivery Agent: --%{with_TXT VDA}
242 Munge bare CR: --%{with_TXT barecr}
243 TLS support: --%{with_TXT tls}
244 IPV6 support: --%{with_TXT ipv6}
245 CDB support: --%{with_TXT cdb}
246 Chroot by default: --%{with_TXT chroot}
247
248 %if %{with dynamicmaps}
249 %package -n %{libname}
250 Summary: Shared libraries required to run Postfix
251 Group: System/Servers
252
253 %description -n %{libname}
254 This package contains shared libraries used by Postfix.
255
256 %if %{with ldap}
257 %package ldap
258 Summary: LDAP map support for Postfix
259 Group: System/Servers
260 BuildRequires: openldap-devel >= 2.1
261 Requires: %name = %epoch:%version-%release
262
263 %description ldap
264 This package provides support for LDAP maps in Postfix.
265 %endif
266
267 %if %{with pcre}
268 %package pcre
269 Summary: PCRE map support for Postfix
270 Group: System/Servers
271 BuildRequires: pcre-devel
272 Requires: %name = %epoch:%version-%release
273
274 %description pcre
275 This package provides support for PCRE (perl compatible regular expression)
276 maps in Postfix.
277 %endif
278
279 %if %{with mysql}
280 %package mysql
281 Summary: MYSQL map support for Postfix
282 Group: System/Servers
283 BuildRequires: mysql-devel
284 Requires: %name = %epoch:%version-%release
285
286 %description mysql
287 This package provides support for MYSQL maps in Postfix.
288 %endif
289
290 %if %{with pgsql}
291 %package pgsql
292 Summary: Postgres SQL map support for Postfix
293 Group: System/Servers
294 # From the release notes of postfix-2.2.11:
295 # The PostgreSQL client was updated after major database API changes
296 # in response to PostgreSQL security issues. This breaks support for
297 # PGSQL versions prior to 8.1.4, 8.0.8, 7.4.13, and 7.3.15. Support
298 # for these requires major code changes which are not possible in a
299 # stable release.
300 BuildRequires: postgresql-devel >= 8.1.4
301 Requires: %name = %epoch:%version-%release
302
303 %description pgsql
304 This package provides support for Postgres SQL maps in Postfix.
305 %endif
306
307 %if %{with sqlite}
308 %package sqlite
309 Summary: SQLite map support for Postfix
310 Group: System/Servers
311 BuildRequires: sqlite3-devel
312 Requires: %name = %epoch:%version-%release
313
314 %description sqlite
315 This package provides support for SQLite maps in Postfix.
316 %endif
317
318 %if %{with pam}
319 %package pam
320 Summary: PAM map support for Postfix
321 Group: System/Servers
322 BuildRequires: pam-devel
323 Requires: %name = %epoch:%version-%release
324
325 %description pam
326 This package provides support for PAM maps in Postfix.
327 %endif
328
329 %if %{with cdb}
330 %package cdb
331 Summary: CDB map support for Postfix
332 Group: System/Servers
333 BuildRequires: libtinycdb-devel
334 Requires: %name = %epoch:%version-%release
335
336 %description cdb
337 This package provides support for CDB maps in Postfix.
338 %endif
339 %endif
340 # dynamicmaps
341
342 %prep
343 %if ! %{with parallel}
344 if [ %{version} != %{distverdot} ]
345 %else
346 if [ %{version} != %{pver} ]
347 %endif
348 then
349 echo do not use "mdvsys update" with postfix 1>&2
350 exit 1
351 fi
352
353 %setup -n %{pname}-%{distver} -q
354
355 releasedate=$(eval echo `echo MAIL_RELEASE_DATE | cpp -P -imacros src/global/mail_version.h`)
356 pver=$(eval echo `echo MAIL_VERSION_NUMBER | cpp -P -imacros src/global/mail_version.h`)
357 if [ "${pver}" != "%{pver}" -o "${releasedate}" != "%{releasedate}" ]; then
358 echo version mismatch between source and spec file
359 echo MAIL_VERSION_NUMBER="${pver}" spec="%{pver}"
360 echo MAIL_RELEASE_DATE="${releasedate}" spec="%{releasedate}"
361 exit 1
362 fi
363
364 %if %{with dynamicmaps}
365 %patch0 -p1 -b .dynamic
366 # ugly hack for 32/64 arches
367 if [ %{_lib} != lib ]; then
368 sed -i -e 's@^/usr/lib/@%{_libdir}/@' conf/postfix-files
369 fi
370 %endif
371
372 # no backup files here, otherwise they get included in %%doc
373 %patch1 -p1 -b .mgaconfig
374 find . -name \*.mgaconfig -exec rm {} \;
375 mkdir -p conf/dist
376 mv conf/main.cf conf/dist
377 cp %{SOURCE2} conf/main.cf
378 # ugly hack for 32/64 arches
379 if [ %{_lib} != lib ]; then
380 sed -i -e "s@/lib/@/%{_lib}@g" conf/main.cf
381 fi
382
383 %if %alternatives
384 %patch2 -p1 -b .alternatives
385 %endif
386
387 %patch3 -p1 -b .dbupgrade
388
389 %patch4 -p1 -b .sdbm
390 %patch5 -p1 -b .dynamicmaps_cf
391 %patch6 -p1 -b .smtpstone
392
393 # Apply PAM Patch
394 %if %{with pam}
395 %patch7 -p1 -b .pam
396 #rm -f README_FILES/PAM_README.pam
397 %endif
398
399 # Apply SMTPD Multiline greeting patch
400 %if %{with multiline}
401 %patch8 -p1 -b .multiline
402 %endif
403
404 %if %{with VDA}
405 %patch9 -p1 -b .vda
406 %patch10 -p1 -b .vda-bigquota
407 # vda patch does not add documentation to postfix-files
408 sed -i.vda -e '/readme_directory\/UUCP_README/a$readme_directory/VDA_README:f:root:-:644' conf/postfix-files
409 %endif
410
411 install -m644 %{SOURCE10} README.mga
412 install -m644 %{SOURCE13} postfix-users-faq.html
413
414 mkdir UCE
415 install -m644 %{SOURCE25} UCE
416 install -m644 %{SOURCE26} UCE
417 install -m644 %{SOURCE27} UCE
418
419 %if %{with chroot}
420 cp -p conf/master.cf conf/master.cf.chroot
421 awk -v NEVER_CHROOT_PROGRAM='^(proxymap|local|pipe|virtual|spawn)$' \
422 -v NEVER_CHROOT_SERVICE='^cyrus$' '
423 BEGIN { IFS="[ \t]+"; OFS="\t"; }
424 /^#/ { print; next; }
425 /^ / { print; next; }
426 $1 ~ NEVER_CHROOT_SERVICE { print; next; }
427 $8 ~ NEVER_CHROOT_PROGRAM { print; next; }
428 $5 == "n" { $5="y"; print $0; next; }
429 { print; }
430 ' conf/master.cf.chroot > conf/master.cf
431 %endif
432
433 # use sed to fix mantools/postlink for our non posix sed
434 #cp -p mantools/postlink mantools/postlink.posix
435 #sed -e 's/\[\[:<:\]\]/\\</g; s/\[\[:>:\]\]/\\>/g' mantools/postlink.posix > mantools/postlink
436 # XXX - andreas - original postlink with perl is segfaulting
437 cp -p mantools/postlink.sed mantools/postlink.posix
438 sed -e 's/\[\[:<:\]\]/\\</g; s/\[\[:>:\]\]/\\>/g' mantools/postlink.posix > mantools/postlink
439
440 %build
441 %define _disable_ld_no_undefined 1
442 %serverbuild
443 OPT="$RPM_OPT_FLAGS"
444 DEBUG=
445 CCARGS=
446 AUXLIBS="%{?ldflags:%ldflags}"
447
448 %ifarch s390 s390x ppc
449 OPT="${OPT} -fsigned-char"
450 %endif
451
452 %if %{with dynamicmaps}
453 # the patch is mixed with SDBM support :(
454 CCARGS="${CCARGS} -DHAS_SDBM -DHAS_DLOPEN"
455 %endif
456
457 %if %{with ldap}
458 CCARGS="${CCARGS} -DHAS_LDAP"
459 %if ! %{with dynamicmaps}
460 AUXLIBS="${AUXLIBS} -lldap -llber"
461 %endif
462 %endif
463 %if %{with pcre}
464 CCARGS="${CCARGS} -DHAS_PCRE"
465 %if ! %{with dynamicmaps}
466 AUXLIBS="${AUXLIBS} -lpcre"
467 %endif
468 %endif
469 %if %{with mysql}
470 CCARGS="${CCARGS} -DHAS_MYSQL -I/usr/include/mysql"
471 %if ! %{with dynamicmaps}
472 AUXLIBS="${AUXLIBS} -lmysqlclient"
473 %endif
474 %endif
475 %if %{with pgsql}
476 CCARGS="${CCARGS} -DHAS_PGSQL -I/usr/include/pgsql"
477 %if ! %{with dynamicmaps}
478 AUXLIBS="${AUXLIBS} -lpq"
479 %endif
480 %endif
481 %if %{with sasl}
482 CCARGS="${CCARGS} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
483 AUXLIBS="${AUXLIBS} -lsasl2"
484 %endif
485 %if ! %{with ipv6}
486 CCARGS="${CCARGS} -DNO_IPV6"
487 %endif
488 %if %{with tls}
489 CCARGS="${CCARGS} -DUSE_TLS -I/usr/include/openssl"
490 AUXLIBS="${AUXLIBS} -lssl -lcrypto"
491 %endif
492 %if %{with cdb}
493 CCARGS="${CCARGS} -DHAS_CDB"
494 %if ! %{with dynamicmaps}
495 AUXLIBS="${AUXLIBS} -lcdb"
496 %endif
497 %endif
498 %if %{with pam}
499 CCARGS="${CCARGS} -DHAS_PAM"
500 %endif
501
502 export CCARGS AUXLIBS OPT DEBUG
503 make -f Makefile.init makefiles
504
505 unset CCARGS AUXLIBS DEBUG OPT
506 make
507 make manpages
508
509 %if %{with dynamicmaps}
510 for i in lib/*.a; do
511 j=${i#lib/lib}
512 ln -s ${i#lib/} lib/libpostfix-${j%.a}.so.1
513 done
514
515 # generate main.cf.default here, since in make it will fail
516 cat > conf/main.cf.default << EOF
517 # DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE
518 # TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX.
519 #
520 EOF
521 LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH} \
522 ./src/postconf/postconf -d | \
523 egrep -v '^(myhostname|mydomain|mynetworks) ' >> conf/main.cf.default
524 %endif
525
526 # add correct parameters to main.cf.dist
527 LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH} \
528 ./src/postconf/postconf -c ./conf/dist -e \
529 %post_install_parameters
530 mv conf/dist/main.cf conf/main.cf.dist
531
532 %install
533 rm -fr %{buildroot}
534
535 # install postfix into the build root
536 LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \
537 make non-interactive-package \
538 install_root=%{buildroot} \
539 config_directory=%{_sysconfdir}/postfix \
540 %post_install_parameters \
541 || exit 1
542
543 mkdir -p %{buildroot}/var/lib/postfix
544
545 %if %{with dynamicmaps}
546 for i in lib/*.a; do
547 j=${i#lib/lib}
548 install $i %{buildroot}%{_libdir}/libpostfix-${j%.a}.so.1
549 done
550 %endif
551
552 # rpm %%doc macro wants to take his files in buildroot
553 rm -fr DOC
554 mkdir DOC
555 mv %{buildroot}%{_docdir}/%name/html DOC/html
556 mv %{buildroot}%{_docdir}/%name/README_FILES DOC/README_FILES
557
558 # for sasl configuration
559 /bin/mkdir -p %{buildroot}%{_sysconfdir}/sasl2
560 cp %{SOURCE15} %{buildroot}%{_sysconfdir}/sasl2/smtpd.conf
561
562 # This installs into the /etc/rc.d/init.d directory
563 /bin/mkdir -p %{buildroot}%{_initrddir}
564 install -c %{SOURCE3} %{buildroot}%{_initrddir}/postfix
565 /bin/mkdir -p %{buildroot}%{_sysconfdir}/pam.d
566 install -c %{SOURCE4} %{buildroot}%{_sysconfdir}/pam.d/smtp
567
568 mkdir -p %{buildroot}%{_sysconfdir}/ppp/ip-{up,down}.d
569 install -c %{SOURCE6} %{buildroot}%{_sysconfdir}/ppp/ip-up.d/postfix
570 install -c %{SOURCE7} %{buildroot}%{_sysconfdir}/ppp/ip-down.d/postfix
571
572 mkdir -p %{buildroot}%{_sysconfdir}/resolvconf/update-libc.d/
573 install -c %{SOURCE8} %{buildroot}%{_sysconfdir}/resolvconf/update-libc.d/postfix
574
575 mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
576
577 touch %{buildroot}%{_sysconfdir}/sysconfig/postfix
578
579 # this is used by some examples (cyrus)
580 mkdir -p %{buildroot}%{queue_directory}/extern
581
582 install -c auxiliary/rmail/rmail %{buildroot}%{_bindir}/rmail
583
584 # copy new aliases files and generate a ghost aliases.db file
585 cp -f %{SOURCE5} %{buildroot}%{_sysconfdir}/postfix/aliases
586 chmod 644 %{buildroot}%{_sysconfdir}/postfix/aliases
587 touch %{buildroot}%{_sysconfdir}/postfix/aliases.db
588
589 # install chroot script and postfinger
590 install -m 0755 %{SOURCE14} %{buildroot}%{_sbindir}/postfix-chroot.sh
591 install -m 0755 %{SOURCE21} %{buildroot}%{_sbindir}/postfinger
592
593 # install qshape
594 install -m755 auxiliary/qshape/qshape.pl %{buildroot}%{_sbindir}/qshape
595 cp man/man1/qshape.1 %{buildroot}%{_mandir}/man1/qshape.1
596
597 # use the /run
598 mkdir -p %{buildroot}/%{queue_directory}/run/saslauthd/
599
600 # RPM compresses man pages automatically.
601 # - Edit postfix-files to reflect this, so post-install won't get confused
602 # when called during package installation.
603 sed -i -e "s@\(/man[158]/.*\.[158]\):@\1%{_extension}:@" %{buildroot}%{_libdir}/postfix/postfix-files
604
605 %if %{with dynamicmaps}
606 # remove files that are not in the main package
607 sed -i -e "/dict_.*\.so/d" %{buildroot}%{_libdir}/postfix/postfix-files
608 %endif
609
610 # remove sample_directory from main.cf (#15297)
611 # the default is /etc/postfix
612 sed -i -e "/^sample_directory/d" %{buildroot}%{_sysconfdir}/postfix/main.cf
613
614 %pre
615 %_pre_useradd postfix %{queue_directory} /bin/false
616 %_pre_groupadd %{maildrop_group} postfix
617 # disable chroot of spawn service in /etc/sysconfig/postfix, but do it only once and only if user did not
618 # modify /etc/sysconfig/postfix manually
619 if grep -qs "^NEVER_CHROOT_PROGRAM='^(proxymap|local|pipe|virtual)$'$" /etc/sysconfig/postfix; then
620 if ! grep -qs "^NEVER_CHROOT_PROGRAM='^(proxymap|local|pipe|virtual|spawn)$'$" /usr/sbin/postfix-chroot.sh; then
621 perl -pi -e "s/^NEVER_CHROOT_PROGRAM=.*\$/NEVER_CHROOT_PROGRAM=\'^(proxymap|local|pipe|virtual|spawn)\\\$\'/" /etc/sysconfig/postfix
622 fi
623 fi
624 # disable some unneeded and potentially harmful nss libraries in /etc/sysconfig/postfix, but do it only once and only if user did not
625 # modify /etc/sysconfig/postfix manually
626 if grep -qs "^IGNORE_NSS_LIBS='^$'$" /etc/sysconfig/postfix; then
627 if ! grep -qs "^IGNORE_NSS_LIBS='^(mdns.*|ldap|db|wins)$'$" /usr/sbin/postfix-chroot.sh; then
628 perl -pi -e "s/^IGNORE_NSS_LIBS=.*\$/IGNORE_NSS_LIBS=\'^(mdns.*|ldap|db|wins)\\\$\'/" /etc/sysconfig/postfix
629 fi
630 fi
631
632 %post
633 # we don't have these maps anymore as separate packages/plugins:
634 # cidr, tcp and sdbm (2007.0)
635 if [ "$1" -eq "2" ]; then
636 sed -i "/^cidr/d;/^sdbm/d;/^tcp/d" %{_sysconfdir}/postfix/dynamicmaps.cf
637 fi
638
639 # upgrade configuration files if necessary
640 %{_sbindir}/postfix \
641 set-permissions \
642 upgrade-configuration \
643 config_directory=%{_sysconfdir}/postfix \
644 %post_install_parameters
645
646 # move previous sasl configuration files to new location if applicable
647 # have to go through many loops to prevent damaging user configuration
648 # this changed around 2007.0 so it should go away soon
649 saslpath=`postconf -h smtpd_sasl_path`
650 if [ "${saslpath}" != "${saslpath##*:}" -o "${saslpath}" != "${saslpath##*/usr/lib}" ]; then
651 postconf -e smtpd_sasl_path=smtpd
652 fi
653
654 for old_smtpd_conf in /etc/postfix/sasl/smtpd.conf %{_libdir}/sasl2/smtpd.conf; do
655 if [ -e ${old_smtpd_conf} ]; then
656 if ! grep -qsve '^\(#.*\|[[:space:]]*\)$' /etc/sasl2/smtpd.conf; then
657 # /etc/sasl2/smtpd.conf missing or just comments
658 if [ -s /etc/sasl2/smtpd.conf ] && [ ! -e /etc/sasl2/smtpd.conf.rpmnew -o /etc/sasl2/smtpd.conf -nt /etc/sasl2/smtpd.conf.rpmnew ]; then
659 mv /etc/sasl2/smtpd.conf /etc/sasl2/smtpd.conf.rpmnew
660 fi
661 mv ${old_smtpd_conf} /etc/sasl2/smtpd.conf
662 else
663 echo "warning: existing ${old_smtpd_conf} will be ignored"
664 fi
665 fi
666 done
667
668 %_create_ssl_certificate postfix
669
670 if [ -e /etc/sysconfig/postfix ]; then
671 %{_sbindir}/postfix-chroot.sh -q update
672 else
673 %if %{with chroot}
674 %{_sbindir}/postfix-chroot.sh -q enable
675 %else
676 %{_sbindir}/postfix-chroot.sh -q create_sysconfig
677 %endif
678 fi
679 %_post_service postfix
680
681 %if %alternatives
682 /usr/sbin/update-alternatives --install %{_sbindir}/sendmail sendmail-command %{sendmail_command} 30 --slave %{_prefix}/lib/sendmail sendmail-command-in_libdir %{sendmail_command}
683 %endif
684
685 %triggerin -- glibc setup nss_ldap nss_db nss_wins nss_mdns
686 # Generate chroot jails on the fly when needed things are installed/upgraded
687 %{_sbindir}/postfix-chroot.sh -q update
688
689 %preun
690 rmqueue() {
691 [ $2 -gt 0 ] || return
692 local i
693 for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
694 if [ -d $1/$i ]; then
695 rmqueue $1/$i $(( $2 - 1 ))
696 rm -f $1/$i/*
697 rmdir $1/$i
698 fi
699 done
700 }
701
702 # selectively remove the queue directory structure
703 queue_directory_remove () {
704 # first remove the "queues"
705 local IFS=', '
706 for dir in `%{_sbindir}/postconf -h hash_queue_names`; do
707 test -d $dir && rmqueue %{queue_directory}/$dir `%{_sbindir}/postconf -h hash_queue_depth`
708 done
709
710 # now remove the other directories
711 for dir in corrupt maildrop pid private public trace; do
712 test -d $dir && /bin/rm -f $dir/*
713 done
714 }
715
716 %_preun_service postfix
717
718 if [ $1 = 0 ]; then
719 # Clean up chroot environment and spool directory
720 %{_sbindir}/postfix-chroot.sh -q remove
721 cd %{queue_directory} && queue_directory_remove || true
722 fi
723
724 %postun
725 %_postun_userdel postfix
726 %_postun_groupdel %{maildrop_group}
727 %if %alternatives
728 if [ ! -e %{sendmail_command} ]; then
729 /usr/sbin/update-alternatives --remove sendmail-command %{sendmail_command}
730 fi
731 %endif
732
733 %clean
734 rm -rf %{buildroot}
735
736 %files
737 %defattr(-, root, root, 755)
738 %dir %{_sysconfdir}/postfix
739 %config(noreplace) %{_sysconfdir}/sasl2/smtpd.conf
740 %config(noreplace) %{_sysconfdir}/postfix/main.cf
741 # http://archives.mandrivalinux.com/cooker/2005-07/msg01109.php
742 %{_sysconfdir}/postfix/main.cf.dist
743 %{_sysconfdir}/postfix/main.cf.default
744 %{_sysconfdir}/postfix/bounce.cf.default
745 %config(noreplace) %{_sysconfdir}/postfix/master.cf
746 %config(noreplace) %{_sysconfdir}/postfix/access
747 %config(noreplace) %{_sysconfdir}/postfix/aliases
748 %ghost %{_sysconfdir}/postfix/aliases.db
749 %config(noreplace) %{_sysconfdir}/postfix/canonical
750 %config(noreplace) %{_sysconfdir}/postfix/generic
751 %config(noreplace) %{_sysconfdir}/postfix/header_checks
752 %config(noreplace) %{_sysconfdir}/postfix/relocated
753 %config(noreplace) %{_sysconfdir}/postfix/transport
754 %config(noreplace) %{_sysconfdir}/postfix/virtual
755 %{_sysconfdir}/postfix/makedefs.out
756 %if %{with dynamicmaps}
757 %config(noreplace) %{_sysconfdir}/postfix/dynamicmaps.cf
758 %endif
759 %attr(0755, root, root) %{_initrddir}/postfix
760 %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/pam.d/smtp
761 %attr(0755, root, root) %config(noreplace) %{_sysconfdir}/ppp/ip-up.d/postfix
762 %attr(0755, root, root) %config(noreplace) %{_sysconfdir}/ppp/ip-down.d/postfix
763 %attr(0755, root, root) %config(noreplace) %{_sysconfdir}/resolvconf/update-libc.d/postfix
764 %ghost %{_sysconfdir}/sysconfig/postfix
765 %attr(0755, root, root) %{queue_directory}/run/saslauthd/
766
767 %dir %attr(0700, postfix, root) /var/lib/postfix
768
769 # For correct directory permissions check postfix-install script
770 %dir %{queue_directory}
771 %dir %attr(0700, postfix, root) %{queue_directory}/active
772 %dir %attr(0700, postfix, root) %{queue_directory}/bounce
773 %dir %attr(0700, postfix, root) %{queue_directory}/corrupt
774 %dir %attr(0700, postfix, root) %{queue_directory}/defer
775 %dir %attr(0700, postfix, root) %{queue_directory}/deferred
776 %dir %attr(0700, postfix, root) %{queue_directory}/flush
777 %dir %attr(0700, postfix, root) %{queue_directory}/hold
778 %dir %attr(0700, postfix, root) %{queue_directory}/incoming
779 %dir %attr(0700, postfix, root) %{queue_directory}/private
780 %dir %attr(0700, postfix, root) %{queue_directory}/trace
781 %dir %attr(0730, postfix, %{maildrop_group}) %{queue_directory}/maildrop
782 %dir %attr(0710, postfix, %{maildrop_group}) %{queue_directory}/public
783 %dir %attr(0755, root, root) %{queue_directory}/pid
784 %dir %attr(0755, root, root) %{queue_directory}/extern
785
786 %doc AAAREADME
787 %doc US_PATENT_6321267
788 %doc examples/smtpd-policy
789 %doc COMPATIBILITY
790 %doc COPYRIGHT
791 %doc HISTORY
792 %doc LICENSE
793 %doc PORTING
794 %doc RELEASE_NOTES*
795 %doc IPv6-ChangeLog
796 %doc TLS_*
797 #doc html
798 %doc DOC/html
799 %doc DOC/README_FILES
800 %doc README.mga
801 %doc postfix-users-faq.html
802 %doc UCE
803
804 %dir %{_libdir}/postfix
805 %attr(0644, root, root) %{_libdir}/postfix/main.cf
806 %attr(0644, root, root) %{_libdir}/postfix/master.cf
807 %attr(0644, root, root) %{_libdir}/postfix/postfix-files
808 %attr(0755, root, root) %{_libdir}/postfix/anvil
809 %attr(0755, root, root) %{_libdir}/postfix/bounce
810 %attr(0755, root, root) %{_libdir}/postfix/cleanup
811 %attr(0755, root, root) %{_libdir}/postfix/discard
812 %attr(0755, root, root) %{_libdir}/postfix/dnsblog
813 %attr(0755, root, root) %{_libdir}/postfix/error
814 %attr(0755, root, root) %{_libdir}/postfix/flush
815 %attr(0755, root, root) %{_libdir}/postfix/lmtp
816 %attr(0755, root, root) %{_libdir}/postfix/local
817 %attr(0755, root, root) %{_libdir}/postfix/master
818 %attr(0755, root, root) %{_libdir}/postfix/nqmgr
819 %attr(0755, root, root) %{_libdir}/postfix/oqmgr
820 %attr(0755, root, root) %{_libdir}/postfix/pickup
821 %attr(0755, root, root) %{_libdir}/postfix/pipe
822 %attr(0755, root, root) %{_libdir}/postfix/postfix-script
823 %attr(0755, root, root) %{_libdir}/postfix/postfix-wrapper
824 %attr(0755, root, root) %{_libdir}/postfix/post-install
825 %attr(0755, root, root) %{_libdir}/postfix/postmulti-script
826 %attr(0755, root, root) %{_libdir}/postfix/postscreen
827 %attr(0755, root, root) %{_libdir}/postfix/proxymap
828 %attr(0755, root, root) %{_libdir}/postfix/qmgr
829 %attr(0755, root, root) %{_libdir}/postfix/qmqpd
830 %attr(0755, root, root) %{_libdir}/postfix/scache
831 %attr(0755, root, root) %{_libdir}/postfix/showq
832 %attr(0755, root, root) %{_libdir}/postfix/smtp
833 %attr(0755, root, root) %{_libdir}/postfix/smtpd
834 %attr(0755, root, root) %{_libdir}/postfix/spawn
835 %attr(0755, root, root) %{_libdir}/postfix/tlsmgr
836 %attr(0755, root, root) %{_libdir}/postfix/tlsproxy
837 %attr(0755, root, root) %{_libdir}/postfix/trivial-rewrite
838 %attr(0755, root, root) %{_libdir}/postfix/verify
839 %attr(0755, root, root) %{_libdir}/postfix/virtual
840
841 %attr(0755, root, root) %{_sbindir}/postalias
842 %attr(0755, root, root) %{_sbindir}/postcat
843 %attr(0755, root, root) %{_sbindir}/postconf
844 %attr(2755,root,%{maildrop_group}) %{_sbindir}/postdrop
845 %attr(2755,root,%{maildrop_group}) %{_sbindir}/postqueue
846 %attr(0755, root, root) %{_sbindir}/postfix
847 %attr(0755, root, root) %{_sbindir}/postkick
848 %attr(0755, root, root) %{_sbindir}/postlock
849 %attr(0755, root, root) %{_sbindir}/postlog
850 %attr(0755, root, root) %{_sbindir}/postmap
851 %attr(0755, root, root) %{_sbindir}/postmulti
852 %attr(0755, root, root) %{_sbindir}/postsuper
853
854 %attr(0755, root, root) %{_sbindir}/qmqp-sink
855 %attr(0755, root, root) %{_sbindir}/qmqp-source
856 %attr(0755, root, root) %{_sbindir}/smtp-sink
857 %attr(0755, root, root) %{_sbindir}/smtp-source
858
859 %attr(0755, root, root) %{_sbindir}/postfinger
860 %attr(0755, root, root) %{_sbindir}/postfix-chroot.sh
861 %attr(0755, root, root) %{_sbindir}/qshape
862
863 %attr(0755, root, root) %{sendmail_command}
864 %attr(0755, root, root) %{_bindir}/mailq
865 %attr(0755, root, root) %{_bindir}/newaliases
866 %attr(0755, root, root) %{_bindir}/rmail
867
868 %{_mandir}/*/*
869
870 %if %{with dynamicmaps}
871 %files -n %{libname}
872 %defattr(755, root, root)
873 %attr(0755, root, root) %{_libdir}/libpostfix-dns.so.1
874 %attr(0755, root, root) %{_libdir}/libpostfix-global.so.1
875 %attr(0755, root, root) %{_libdir}/libpostfix-master.so.1
876 %attr(0755, root, root) %{_libdir}/libpostfix-util.so.1
877 %attr(0755, root, root) %{_libdir}/libpostfix-tls.so.1
878 %attr(0755, root, root) %{_libdir}/libpostfix-milter.so.1
879 %attr(0755, root, root) %{_libdir}/libpostfix-xsasl.so.1
880
881 %if %{with ldap}
882 %files ldap
883 %attr(755, root, root) %{_libdir}/postfix/dict_ldap.so
884 %post ldap
885 %dynmap_add_cmd ldap
886 %postun ldap
887 %dynmap_rm_cmd ldap
888 %endif
889
890 %if %{with mysql}
891 %files mysql
892 %attr(755, root, root) %{_libdir}/postfix/dict_mysql.so
893 %post mysql
894 %dynmap_add_cmd mysql
895 %postun mysql
896 %dynmap_rm_cmd mysql
897 %endif
898
899 %if %{with pam}
900 %files pam
901 %attr(755, root, root) %{_libdir}/postfix/dict_pam.so
902 %post pam
903 %dynmap_add_cmd pam
904 %postun pam
905 %dynmap_rm_cmd pam
906 %endif
907
908 %if %{with pcre}
909 %files pcre
910 %attr(755, root, root) %{_libdir}/postfix/dict_pcre.so
911 %post pcre
912 %dynmap_add_cmd pcre
913 %postun pcre
914 %dynmap_rm_cmd pcre
915 %endif
916
917 %if %{with pgsql}
918 %files pgsql
919 %attr(755, root, root) %{_libdir}/postfix/dict_pgsql.so
920 %post pgsql
921 %dynmap_add_cmd pgsql
922 %postun pgsql
923 %dynmap_rm_cmd pgsql
924 %endif
925
926 %if %{with sqlite}
927 %files sqlite
928 %attr(755, root, root) %{_libdir}/postfix/dict_sqlite.so
929 %post sqlite
930 %dynmap_add_cmd sqlite
931 %postun sqlite
932 %dynmap_rm_cmd sqlite
933 %endif
934
935 %if %{with cdb}
936 %files cdb
937 %attr(755, root, root) %{_libdir}/postfix/dict_cdb.so
938 %post cdb
939 %dynmap_add_cmd cdb -m
940 %postun cdb
941 %dynmap_rm_cmd cdb
942 %endif
943
944 %endif

  ViewVC Help
Powered by ViewVC 1.1.30