Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

postfix.spec

By: fakessh on Oct 3rd, 2011  |  syntax: None  |  size: 43.66 KB  |  views: 153  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # W A R N I N G -- DO NOT EDIT THIS FILE -- W A R N I N G
  2. #
  3. # postfix.spec
  4. #
  5. # This file was generated automatically from /usr/src/redhat/SOURCES/postfix.spec.in.
  6. # If you want to build postfix with other options see make-postfix.spec in
  7. # the same directory for instructions.
  8. # --
  9. # $Id: postfix.spec.in,v 2.305.2.13.2.7 2008/03/09 09:46:05 sjmudd Exp $
  10. #
  11. # File used to generate the distribution-specific postfix.spec file.
  12. # If you need to make changes to postfix.spec, make them to postfix.spec.in
  13. # and regenerate the spec file.
  14. #
  15. # See make-postfix.spec in %{_sourcedir} for more information.
  16. #
  17. # This spec file was built on distribution: rhel-5.0
  18. #
  19. # Information imported from postfix.spec.in: DO NOT CHANGE IT BY HAND
  20. #
  21. # mysql_paths              - paths where locally installed MySQL resides (or 0)
  22. #                            - if using this option mysql_paths should be as
  23. #                              follows: </pathto/mysql/include>:</pathto/mysql/lib>
  24. #                              e.g.:    /usr/mysql/include:/usr/mysql/lib
  25. #                            - The order is important and only 2 directories may
  26. #                              be given.
  27. # requires_db              - used to add dbX dependencies in the package
  28. # smtpd_multiline_greeting - my patch to allow multiline banner
  29. # mps                      - man page suffix, .gz except Mandrake >= 8 which uses .bz2
  30. # with_cdb                 - include CDB support by Michael Tokarev
  31. #                            <mjt@corpit.ru>
  32. # with_dovecot             - include DOVECOT SASL authentication
  33. # with_ldap                - include LDAP support
  34. # with_mysql               - include support for www.mysql.com's MySQL rpms
  35. # with_mysql_redhat        - include support for RedHat's MySQL rpms
  36. # with_pcre                - include pcre support
  37. # with_pgsql               - include Postgres database support
  38. # with_sasl                - include Cyrus SASL/AUTH support (0 to disable sasl,
  39. #                            1 for sasl v1, or 2 for sasl v2, sasl_library is
  40. #                            the sasl library to link against, distribution dependent)
  41. # with_tls                 - include TLS support
  42. # with_tlsfix              - include TLS fix
  43. #                            - needed for rh6.2, rh9 and rhel3
  44. # with_vda                 - add virtual delivery agent patch
  45. # with_sqlite              - include SQLITE support
  46. #
  47. # Please send bugfixes and comments to the packager.
  48. #
  49. # distribution which the spec file was built from
  50. %define distribution rhel-5.0
  51.  
  52. # distribution which we are building Postfix on
  53. # - call my script once to speed up build process
  54. %define distro_info     %(sh $(rpm --eval '%{_sourcedir}')/postfix-get-distribution --distro-info)
  55. %define build_dist_full %(echo "%distro_info" | cut -d" " -f5)
  56. %define build_name      %(echo "%distro_info" | cut -d" " -f1)
  57. %define build_major     %(echo "%distro_info" | cut -d" " -f3)
  58. %define build_minor     %(echo "%distro_info" | cut -d" " -f4)
  59. %define build_dist      %{build_name}-%{build_major}.%{build_minor}
  60. %define mps %(test "%{build_name}" = mandrake -a "%{build_major}" -ge 8 && echo .bz2 || echo .gz)
  61.  
  62. %define mysql_paths 0
  63. %define mysql_local %(test "%{mysql_paths}" != 0 && echo 1 || echo 0)
  64. %define mysql_include %(echo "%{mysql_paths}" | cut -d: -f1)
  65. %define mysql_lib %(echo "%{mysql_paths}" | cut -d: -f2)
  66. # determine PCRE library based on distribution name
  67. %define pcre_requires %(test %{build_dist} = mandrake && echo libpcre0 || echo pcre)
  68. # determine SASL library based on distribution name
  69. %define sasl_library %(test %{build_dist} = mandrake && echo libsasl-devel || echo cyrus-sasl-devel)
  70. %define requires_db 4
  71. %define requires_zlib 1
  72. %define smtpd_multiline_greeting 1
  73.  
  74. # alternatives priority can now be changed in one place.
  75. # - this used to be 30 but RH seems to have defined other higher values
  76. #   and some users need another value.
  77. #   Don't change this unless you really think you need to.
  78. %define with_alt_prio     30
  79.  
  80. %define with_cdb          0
  81. %define with_ldap         1
  82. %define with_mysql        0
  83. %define with_mysql_redhat 1
  84. %define with_pcre         1
  85. %define with_pgsql        1
  86. %define with_sasl         2
  87. %define with_dovecot      1
  88. %define with_tls          1
  89. %define with_tlsfix       2
  90. %define with_vda          1
  91. %define with_sqlite       0
  92.  
  93. # support the conditional builds via rpm's --with debug
  94. %define debug %{?_with_debug:1}%{?!_with_debug:0}
  95.  
  96. # patch and version information
  97. %define V_vda        2.8.0
  98. %define V_postfinger 1.30
  99.  
  100. # If set to 1 if official version, 0 if snapshot
  101. %define official 1
  102. %define V_postfix 2.8.5
  103. %define rel 1.cdb.pcre.pgsql.mysql.sasl2.vda.sqlite.rhel5
  104. %if %{official}
  105. %define V_tarball %{V_postfix}
  106. %define ftp_dir official
  107. %else
  108. %define V_release_date RC2
  109. %define V_tarball %{V_postfix}-%{V_release_date}
  110. %define ftp_dir experimental
  111. %endif
  112. # rpm does not accept '-' in version strings so replace them with a '.'
  113. # - (only affects snapshots)
  114. %define V_package %(echo %{V_tarball} | sed 's/-/./g')
  115.  
  116. # rpm-workaround:
  117. #
  118. # We can NOT use %{_docdir}/%{name}-%{version} for installing the docs
  119. # from the 'install' section as RPM kindly removes this directory after
  120. # we have installed files to it. (standard part of 'doc' processing!)
  121. #
  122. #define docdir %{_docdir}/%{name}-%{version}
  123. %define docdir %{_docdir}/%{name}-%{V_package}-documentation
  124. %define readme_dir   %{docdir}/readme
  125. %define html_dir     %{docdir}/html
  126. %define examples_dir %{docdir}/examples
  127.  
  128. %define newaliases_path %{_bindir}/newaliases.postfix
  129. %define mailq_path %{_bindir}/mailq.postfix
  130. %define rmail_path %{_bindir}/rmail.postfix
  131. %define sendmail_path %{_sbindir}/sendmail.postfix
  132. # Don't use %{_libdir} as it gives the wrong directory on x86_64 servers
  133. %define usrlib_sendmail /usr/lib/sendmail.postfix
  134.  
  135. %define initdir /etc/rc.d/init.d
  136.  
  137. %define whinge /usr/bin/logger -p mail.info -t postfix/rpm
  138. %define die_cmd die(){ %whinge "$*"; exit 1; }
  139.  
  140. Name: postfix
  141. Group: System Environment/Daemons
  142. URL: http://www.postfix.org
  143. License: IBM Public License
  144. PreReq: chkconfig, initscripts, shadow-utils
  145. PreReq: /etc/init.d, /sbin/service, chkconfig >= 1.3
  146. Epoch: 2
  147.  
  148. Provides: MTA smtpd smtpdaemon
  149. Provides: %{_sbindir}/sendmail %{_bindir}/mailq %{_bindir}/newaliases %{_bindir}/rmail
  150. Provides: %{_mandir}/man1/newaliases.1.%{mps} %{_mandir}/man5/newaliases.5.%{mps}
  151.  
  152. Version: %{V_package}
  153. Release: %{rel}
  154. Packager: Simon J Mudd <sjmudd@pobox.com>
  155. Summary: Postfix Mail Transport Agent
  156. Vendor: Built on %{build_dist_full} (%{build_dist})
  157. Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/%{ftp_dir}/postfix-%{V_tarball}.tar.gz
  158. Source1: make-postfix.rpm
  159. Source2: postfix-get-distribution
  160. Source3: postfix-etc-init.d-postfix
  161. Source4: postfix-chroot.sh
  162. Source5: postfix-aliases
  163. Source7: postfix.spec.in
  164. Source8: make-postfix.spec
  165. Source10: README-Postfix-SASL-RedHat.txt
  166. Source16: http://postfix.wl0.org/ftp/postfinger/postfinger-%{V_postfinger}
  167.  
  168. # Sources >= 100 are config files
  169. Source100: postfix-sasl.conf
  170. Source101: postfix-pam.conf
  171. Source102: postfix-saslauthd.conf
  172.  
  173. # Obligatory Patches
  174. Patch3: postfix-files.patch
  175. Patch5: postfix-makedefs.patch
  176.  
  177. # Optional patches
  178. # FIXME: There is also a 64-bit patch (not included) for 2.5.4
  179. Patch4:  http://vda.sourceforge.net/VDA/postfix-vda-%{V_vda}.patch.gz
  180.  
  181. # Multiline Greeting ptch
  182. Patch99: ftp://ftp.wl0.org/SOURCES/postfix-2.8.1-multiline-greeting.patch
  183.  
  184. BuildRoot: %{_tmppath}/%{name}-%{V_package}-buildroot
  185.  
  186. # Determine packaging requirements
  187. BuildRequires: /usr/bin/cc, gawk, sed, ed, patch, rpm >= 4
  188. Requires: gawk, sed, ed
  189.  
  190. %if %{requires_db}
  191. Requires: db%{requires_db}
  192. BuildRequires: db%{requires_db}-devel
  193. %endif
  194.  
  195. %if %{with_cdb}
  196. Requires: tinycdb
  197. BuildRequires: tinycdb
  198. %endif
  199.  
  200. %if %{with_ldap}
  201. Requires: openldap >= 1.2.9
  202. BuildRequires: openldap-devel >= 1.2.9
  203. %endif
  204.  
  205. %if %{with_pcre}
  206. Requires: %{pcre_requires}
  207. BuildRequires: %{pcre_requires}, %{pcre_requires}-devel
  208. %endif
  209.  
  210. # Needed by some Mysql and some TLS packages
  211. %if %{requires_zlib}
  212. Requires: zlib
  213. BuildRequires: zlib-devel
  214. %endif
  215.  
  216. %if %{with_mysql_redhat}
  217. Requires: mysql
  218. BuildRequires: mysql, mysql-devel
  219. %endif
  220.  
  221. %if %{mysql_local}
  222. BuildRequires: %{mysql_include}/mysql.h
  223. Requires: %{mysql_lib}/libmysqlclient.so
  224. %endif
  225.  
  226. %if %{with_mysql}
  227. Requires: MySQL-shared
  228. BuildRequires: MySQL-shared, MySQL-devel
  229. %endif
  230.  
  231. %if %{with_pgsql}
  232. Requires: postgresql-libs
  233. BuildRequires: postgresql-devel
  234. %endif
  235.  
  236. %if %{with_sasl}
  237. Requires: cyrus-sasl
  238. BuildRequires: cyrus-sasl, %{sasl_library}
  239. %endif
  240.  
  241. # Postfix compiled with Dovecot support only works with dovecot >= 1
  242. # - however requiring the dovecot rpm to be installed when it may
  243. #   not be used means that there will be NO explicit dependency
  244. #   added to the rpm.
  245. %if %{with_dovecot}
  246. #Requires: dovecot >= 1         NOT REQUIRED / DO NOT ADD
  247. %endif
  248.  
  249. %if %{with_tls}
  250. Requires: openssl
  251. BuildRequires: openssl-devel
  252. %endif
  253.  
  254. %if %{with_sqlite}
  255. Requires: sqlite
  256. BuildRequires: sqlite-devel
  257. %endif
  258.  
  259. %description
  260. Postfix is a Mail Transport Agent (MTA), intended to be an alternative
  261. to the widely-used sendmail.  This package includes optional support for
  262. LDAP, pcre, mysql, SMTP AUTH (SASL) and TLS.
  263.  
  264. See http://www.redhat.com/support/docs/faqs/RH-postfix-FAQ/book1.html,
  265. a slightly outdated FAQ, which covers the steps involved in installing
  266. and configuring postfix.
  267.  
  268. The binary and source rpms I produce are currently available at
  269.         http://postfix.WL0.org, ftp://ftp.WL0.org
  270. and the mirrors which can be found at the following URL:
  271.         http://postfix.WL0.org/en/mirrors/
  272.  
  273. This package/specfile was built from postfix.spec.in.
  274. To see the build options used to build this package see the file %{_sysconfdir}/postfix/postfix.spec.cf
  275.  
  276. To use postfix with alternative options download the source package and
  277. rebuild the binary package following the instructions in the source
  278. package or on my web page.
  279.  
  280. %prep
  281. umask 022
  282.  
  283. %{die_cmd}
  284.  
  285. # check custom MYSQL path values are sensible to avoid problems
  286. # with people mixing include and lib directories
  287. if [ "%{mysql_paths}" != 0 ]; then
  288.         exit_error() {
  289.                 cat <<-EOF
  290.                 *************************************************************************
  291.                 CUSTOM MYSQL configuration error
  292.                 mysql_paths=%mysql_paths        (0=Not used)
  293.                 mysql_local=%mysql_local        (0=Not used,1=used)
  294.                 mysql_include=%mysql_include    (include directory)
  295.                 mysql_lib=%mysql_lib            (lib directory)
  296.                 ERROR: $1
  297.                         If you don't want to use a custom mysql installation set
  298.                         mysql_paths to 0.
  299.                 *************************************************************************
  300.                 EOF
  301.                 exit 1
  302.         }
  303.         [ $(echo "%{mysql_paths}" | awk -F: '{ print NF }') = 2 ] || \
  304.                 exit_error "mysql_paths should be of the form /pathto/mysql/include:/pathto/mysql/lib, with only 2 directories"
  305.         echo "%{mysql_include}" | grep -q "/lib" && \
  306.                 exit_error "The first path in mysql_paths appears to be a library path: it should be an include path (e.g. /usr/local/include)"
  307.         echo "%{mysql_lib}" | grep -q "/include" && \
  308.                 exit_error "The second path in mysql_paths appears to be an include path: it should be a library path (e.g. /usr/local/lib)"
  309. fi
  310.  
  311. # Warn if the distribution this spec file was made for isn't the same as
  312. # the current distribution, using a script in the SOURCES directory.
  313. # This will be removed and built into the spec file later.
  314.  
  315. distribution=$(sh $(rpm --eval '%{_sourcedir}')/postfix-get-distribution)
  316.  
  317. if [ "${distribution}" != "%{distribution}" ]; then
  318.     cat <<ENDTEXT
  319. ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
  320.  
  321. This postfix.spec file may not work correctly.
  322. It was built for %{distribution}, while you are running ${distribution}.
  323.  
  324. Please rebuild postfix.spec for your distribution by following the
  325. instructions in postfix.spec.cf.
  326.  
  327. If this procedure does not allow you to produce a working package, please
  328. let me know.
  329.  
  330. ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
  331. ENDTEXT
  332.         exit 1
  333. fi
  334.  
  335. %setup -q -n postfix-%{V_tarball}
  336.  
  337. # Apply obligatory patches
  338. %patch3 -p1 -b .alternatives
  339. %patch5 -p1 -b .notls
  340.  
  341. # Apply optional patches
  342. %if %{with_vda}
  343.   test -e  %{_sourcedir}/postfix-vda-%{V_vda}.patch.gz && \
  344.   gzip -dc %{_sourcedir}/postfix-vda-%{V_vda}.patch.gz | patch -p1 -b --suffix .vda -s || \
  345.     die "POSTFIX RPM: %{_sourcedir}/postfix-vda-%{V_vda}.patch.gz not found or patch failed"
  346. %endif
  347.  
  348. %if %{smtpd_multiline_greeting}
  349. %patch99  -p1 -b .multiline
  350. %endif
  351.  
  352. # Modify master.cf: rmail --> rmail.postfix
  353. ed conf/master.cf <<EOF || exit 1
  354. H
  355. ,s/rmail/rmail.postfix/
  356. w
  357. q
  358. EOF
  359.  
  360. %build
  361. umask 022
  362.  
  363. CCARGS=""
  364. AUXLIBS=
  365.  
  366. %ifarch s390 s390x ppc
  367. CCARGS="${CCARGS} -fsigned-char"
  368. %endif
  369.  
  370. %if %{with_cdb}
  371.   CCARGS="${CCARGS} -DHAS_CDB"
  372.   AUXLIBS="${AUXLIBS} -lcdb"
  373. %endif
  374.  
  375. %if %{with_ldap}
  376.   CCARGS="${CCARGS} -DHAS_LDAP"
  377.   AUXLIBS="${AUXLIBS} -L/usr/%{_lib} -lldap -llber"
  378. %endif
  379.  
  380. %if %{with_pcre}
  381.   # -I option required for pcre 3.4 (and later?)
  382.   CCARGS="${CCARGS} -DHAS_PCRE -I/usr/include/pcre"
  383.   AUXLIBS="${AUXLIBS} -lpcre"
  384. %else
  385.   # we need to explicitly disable pcre unless asked for, otherwise it will
  386.   # be included if present on the build system. This may cause problems.
  387.   CCARGS="${CCARGS} -DNO_PCRE"
  388. %endif
  389.  
  390. # Postfix compiles without needing zlib on RedHat's mysql package, but
  391. # requires zlib when using MySQL's package or if using a locally installed
  392. # MySQL binary.
  393. %if %{with_mysql} || %{with_mysql_redhat}
  394.   CCARGS="${CCARGS} -DHAS_MYSQL -I/usr/include/mysql"
  395.   AUXLIBS="${AUXLIBS} -L/usr/%{_lib}/mysql -lmysqlclient -lm"
  396. %endif
  397.  
  398. %if %{mysql_local}
  399.   CCARGS="${CCARGS} -DHAS_MYSQL -I%{mysql_include}"
  400.   AUXLIBS="${AUXLIBS} -L%{mysql_lib} -lmysqlclient -lm"
  401. %endif
  402.  
  403. %if %{with_pgsql}
  404.   CCARGS="${CCARGS} -DHAS_PGSQL -I/usr/include/pgsql"
  405.   AUXLIBS="${AUXLIBS} -lpq -lcrypt"
  406. %endif
  407.  
  408. %if %{with_sqlite}
  409.   CCARGS="${CCARGS} -DHAS_SQLITE -I/usr/include"
  410.   AUXLIBS="${AUXLIBS} -lsqlite3"
  411. %endif
  412.  
  413. %if %{with_sasl}
  414.   if [ "%{with_sasl}" -le 1 ]; then
  415.     %define sasl_lib_dir %{_libdir}/sasl
  416.     CCARGS="${CCARGS} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL"
  417.     AUXLIBS="${AUXLIBS} -L%{sasl_lib_dir} -lsasl"
  418.   else
  419.     %define sasl_lib_dir %{_libdir}/sasl2
  420.     CCARGS="${CCARGS} -I/usr/include/sasl -DUSE_SASL_AUTH -DUSE_CYRUS_SASL"
  421.     AUXLIBS="${AUXLIBS} -L%{sasl_lib_dir} -lsasl2"
  422.   fi
  423. %endif
  424.  
  425. # Provide support for Dovecot SASL
  426. %if %{with_dovecot}
  427.   CCARGS="${CCARGS} -DUSE_SASL_AUTH"
  428.   # make dovecot the default IFF we don't include SASL
  429.   if [ "%{with_sasl}" = 0 ]; then
  430.     CCARGS="${CCARGS} -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
  431.   fi
  432. %endif
  433.  
  434. %if %{with_tls}
  435. # See http://www.openldap.org/lists/openldap-devel/200105/msg00008.html
  436. # - rh6.2 needs LIBS=-ldl to build correctly.
  437. # - reported by Jauder Ho <jauderho@carumba.com>
  438.   if pkg-config openssl; then
  439.     CCARGS="${CCARGS} -DUSE_TLS $(pkg-config --cflags openssl)"
  440.     AUXLIBS="${AUXLIBS} $(pkg-config --libs openssl)"
  441.   else
  442.     #
  443.     # CHECK THIS - these lines may no longer be needed (required for external TLS patch)
  444.     #
  445.     [ "%{with_tlsfix}" = 1 ] && LIBS=-ldl
  446.     [ "%{with_tlsfix}" = 2 ] && CCARGS="${CCARGS} -I/usr/kerberos/include"
  447.     CCARGS="${CCARGS} -DUSE_TLS -I/usr/include/openssl"
  448.     AUXLIBS="${AUXLIBS} -lssl -lcrypto"
  449.   fi
  450. %else
  451. # explicitly disable TLS otherwise will be built on machine if
  452. # openssl is available
  453.         CCARGS="${CCARGS} -DNO_TLS"
  454. %endif
  455.  
  456. # Required by some TLS implementations (RHEL 3 and RH9) and also some MySQL
  457. # packages
  458. %if %{requires_zlib}
  459.   AUXLIBS="${AUXLIBS} -lz"
  460. %endif
  461.  
  462. export CCARGS AUXLIBS
  463. make tidy
  464. make -f Makefile.init makefiles
  465. unset CCARGS AUXLIBS
  466. # -Wno-comment needed due to large number of warnings on RHEL5
  467. # suggestion by Eric Hoeve <eric@ehoeve.com>
  468. RPM_OPT_FLAGS="$(rpm --eval '%{optflags}' | %{__perl} -pe 's/(-g|\{|\})//g')"
  469. make DEBUG="%{?_with_debug:-g}" OPT="$RPM_OPT_FLAGS -fsigned-char -Wno-comment -Wno-missing-braces -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-uninitialized"
  470.  
  471. %pre
  472. umask 022
  473.  
  474. # create postfix user and group, and maildrop group if necessary.
  475. # Use perl rather than looking in /etc/passwd or /etc/group as this works
  476. # in a wider NIS or LDAP environment
  477.  
  478. /usr/bin/getent group postdrop >/dev/null || {
  479.     %whinge "Adding postdrop group to system"
  480.     %{_sbindir}/groupadd -r postdrop
  481. }
  482.  
  483. /usr/bin/getent group postfix >/dev/null || {
  484.     %whinge "Adding postfix group to system"
  485.     %{_sbindir}/groupadd -r postfix
  486. }
  487.  
  488. /usr/bin/getent passwd postfix >/dev/null || {
  489.     %whinge "Adding postfix user to system"
  490.     %{_sbindir}/useradd -d %{_var}/spool/postfix -s /bin/true -g postfix -G mail -M -r postfix
  491. }
  492.  
  493. # Add postfix user to the mail group.  This is needed for people using cyrus,
  494. # linked by unix sockets (amongst other things).
  495. test -z "$(id postfix | awk '{print $3}' | sed -e 's/groups=//' | grep mail)" && {
  496.     %whinge "Adding postfix user to mail group"
  497.     %{_sbindir}/usermod -G mail postfix
  498. }
  499.  
  500. # check for a new install and see if a non package installed Postfix might
  501. # exist.  Attempt to avoid overwriting the source config and provide a warning.
  502. if [ "$1" = 0 ]; then
  503.     timenow=$(date +%Y%m%d-%H%M%)
  504.     pretext="This is a new Postfix RPM installation"
  505.     [ -f %{_sysconfdir}/postfix ] && {
  506.         [ -n "$pretext" ] && %whinge "$pretext" && pretext=
  507.         %whinge "Detected a possible previous non-RPM install in %{_sysconfdir}/postfix."
  508.         %whinge "- going to move it out of the way to %{_sysconfdir}/postfix.$timenow."
  509.         mv %{_sysconfdir}/postfix %{_sysconfdir}/postfix.$timenow
  510.     }
  511.     [ -d %{initdir}/postfix ] && {
  512.         [ -n "$pretext" ] && %whinge "$pretext" && pretext=
  513.         %whinge "Detected a possible previous non-RPM startup script %{initdir}/postfix."
  514.         %whinge "- going to move it out of the way to %{initdir}/postfix.$timenow."
  515.         mv %{initdir}/postfix %{initdir}/postfix.$timenow
  516.     }
  517. fi
  518.  
  519. exit 0
  520.  
  521. %install
  522. umask 022
  523.  
  524. [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ] && {
  525.     rm -rf   ${RPM_BUILD_ROOT}
  526.     mkdir -p ${RPM_BUILD_ROOT}
  527. }
  528.  
  529. %{?!debug:strip -R .comment --strip-unneeded bin/* libexec/*}
  530.  
  531. # rename man pages which may conflict with sendmail's
  532. mv man/man1/mailq.1      man/man1/mailq.postfix.1
  533. mv man/man1/newaliases.1 man/man1/newaliases.postfix.1
  534. mv man/man1/sendmail.1   man/man1/sendmail.postfix.1
  535. mv man/man5/aliases.5    man/man5/aliases.postfix.5
  536.  
  537. # install postfix into build root
  538. sh postfix-install -non-interactive \
  539.        install_root=${RPM_BUILD_ROOT} \
  540.        config_directory=%{_sysconfdir}/postfix \
  541.        daemon_directory=%{_libexecdir}/postfix \
  542.        command_directory=%{_sbindir} \
  543.        queue_directory=%{_var}/spool/postfix \
  544.        sendmail_path=%{sendmail_path} \
  545.        newaliases_path=%{newaliases_path} \
  546.        mailq_path=%{mailq_path} \
  547.        mail_owner=postfix \
  548.        setgid_group=postdrop \
  549.        html_directory=%{html_dir} \
  550.        manpage_directory=%{_mandir} \
  551.        readme_directory=%{readme_dir} || exit 1
  552.  
  553. # To be compatible with later versions of RH sendmail/postfix packages
  554. # make /usr/lib/sendmail.postfix point to /usr/sbin/sendmail.postfix.
  555. # The alternatives then point /usr/lib/sendmail to /usr/lib/sendmail.postfix.
  556. # This *is* all a bit silly ...
  557.  
  558. install -d -m755 $RPM_BUILD_ROOT/usr/lib
  559. ln -sf ../sbin/sendmail.postfix $RPM_BUILD_ROOT%{usrlib_sendmail}
  560.  
  561. # RPM compresses man pages automatically.  Edit postfix-files to avoid
  562. # confusing post-install.
  563. ed ${RPM_BUILD_ROOT}%{_libexecdir}/postfix/postfix-files <<EOF || exit 1
  564. H
  565. ,s/\(\/man[158]\/.*\.[158]\):/\1%{mps}:/
  566. w
  567. q
  568. EOF
  569.  
  570. # Change alias_maps and alias_database default directory to use
  571. # %{_sysconfdir}/postfix
  572. bin/postconf -c ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix -e \
  573.         "alias_maps = hash:%{_sysconfdir}/postfix/aliases" \
  574.         "alias_database = hash:%{_sysconfdir}/postfix/aliases" \
  575. || exit 1
  576.  
  577. # Change default smtpd_sasl... parameters for dovecot
  578. # - override postfix default behaviour IFF not using cyrus sasl.
  579. # - main.cf can still be adjusted manually after installation if required.
  580. %if %{with_dovecot}
  581.   if [ "%{with_sasl}" = 0 ]; then
  582.     bin/postconf -c ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix -e \
  583.         "smtpd_sasl_type = dovecot" \
  584.         "smtpd_sasl_path = private/auth" \
  585.     || exit 1
  586.   fi
  587. %endif
  588. # Fix a typo in some of the documentation.
  589. perl -pi -e "s/DEF_SASL_SERVER_TYPE/DEF_SERVER_SASL_TYPE/g" */SASL_README*
  590.  
  591. # Install Sys V init script
  592. mkdir -p ${RPM_BUILD_ROOT}%{initdir}
  593. install -c %{_sourcedir}/postfix-etc-init.d-postfix \
  594.                   ${RPM_BUILD_ROOT}%{initdir}/postfix
  595.  
  596. install -c auxiliary/rmail/rmail ${RPM_BUILD_ROOT}%{rmail_path}
  597. install -c auxiliary/qshape/qshape.pl ${RPM_BUILD_ROOT}/%{_sbindir}/qshape
  598.  
  599. # copy new aliases files and generate a ghost aliases.db file
  600. cp -f %{_sourcedir}/postfix-aliases ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/aliases
  601. chmod 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/aliases
  602.  
  603. touch ${RPM_BUILD_ROOT}/%{_sysconfdir}/postfix/aliases.db
  604.  
  605. for i in active bounce corrupt defer deferred flush incoming private saved \
  606.          hold maildrop public pid; do
  607.     mkdir -p ${RPM_BUILD_ROOT}%{_var}/spool/postfix/$i
  608. done
  609.  
  610. # install qmqp-source, smtp-sink & smtp-source by hand
  611. for i in qmqp-source smtp-sink smtp-source; do
  612.   install -c -m 755 bin/$i ${RPM_BUILD_ROOT}%{_sbindir}/$i
  613. done
  614.  
  615. # install postfinger and postfix-chroot.sh scripts
  616. # - postfix-chroot.sh is placed in /etc/postfix to make it more visible
  617. install -c -m 755 %{_sourcedir}/postfinger-%{V_postfinger} ${RPM_BUILD_ROOT}%{_bindir}/postfinger
  618. install -c -m 755 %{_sourcedir}/postfix-chroot.sh ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/
  619.  
  620. [ -d "${RPM_BUILD_ROOT}%{html_dir}" ]     || mkdir -p ${RPM_BUILD_ROOT}%{html_dir}
  621. [ -d "${RPM_BUILD_ROOT}%{readme_dir}" ]   || mkdir -p ${RPM_BUILD_ROOT}%{readme_dir}
  622. install -c -m 644 %{_sourcedir}/README-Postfix-SASL-RedHat.txt ${RPM_BUILD_ROOT}%{readme_dir}/
  623. [ -d "${RPM_BUILD_ROOT}%{examples_dir}" ] || mkdir -p ${RPM_BUILD_ROOT}%{examples_dir}
  624. cp -pr examples/* ${RPM_BUILD_ROOT}%{examples_dir}/
  625. # disable execution permissions to avoid rpm generating dependencies
  626. find ${RPM_BUILD_ROOT}%{examples_dir}/ -type f -exec chmod -x {} \;
  627.  
  628. # Install odd documentation files
  629. for file in AAAREADME COMPATIBILITY COPYRIGHT HISTORY PORTING \
  630.         RELEASE_NOTES RELEASE_NOTES-1.0 RELEASE_NOTES-1.1 \
  631.         RELEASE_NOTES-2.0 RELEASE_NOTES-2.1 RELEASE_NOTES-2.2 \
  632.         RELEASE_NOTES-2.3 RELEASE_NOTES-2.4 RELEASE_NOTES-2.5 \
  633.         RELEASE_NOTES-2.6 RELEASE_NOTES-2.7 \
  634.         TLS_ACKNOWLEDGEMENTS TLS_CHANGES TLS_LICENSE LICENSE \
  635.         US_PATENT_6321267 IPv6-ChangeLog TLS_TODO
  636. do
  637.         install -c -m 644 $file ${RPM_BUILD_ROOT}%{docdir}/
  638. done
  639. cat <<EOF >${RPM_BUILD_ROOT}%{docdir}/SEE_ALSO
  640. %{_docdir}/%{name}-%{version} may contain other documentation files.
  641. EOF
  642.  
  643. # added for convenience
  644. ln -sf %{html_dir}     ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/html
  645. ln -sf %{readme_dir}   ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/readme
  646. ln -sf %{examples_dir} ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/examples
  647.  
  648. # Install the smtpd.conf file for SASL support.
  649. %if %{with_sasl}
  650. mkdir -p ${RPM_BUILD_ROOT}%{sasl_lib_dir}
  651. install -m 644 %SOURCE100 ${RPM_BUILD_ROOT}%{sasl_lib_dir}/smtpd.conf
  652. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d
  653. install -m 644 %SOURCE101 ${RPM_BUILD_ROOT}%{_sysconfdir}/pam.d/smtp.postfix
  654. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
  655. install -m 644 %SOURCE102 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/saslauthd.postfix
  656. %endif
  657.  
  658. # Include README.rpm explaining where the documentation can be found and
  659. # also pointing out how to get updated copies of my package
  660. cat <<EOF > ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/README.rpm
  661. README.rpm
  662. ==========
  663.  
  664. Documentation
  665. -------------
  666.  
  667. Postfix documentation should be available in the directory %{docdir}/.
  668. I have also added a symbolic link to the readme_files and html
  669. directories from %{_sysconfdir}/postfix.
  670.  
  671. The main Postfix web site is http://www.postfix.org.
  672.  
  673. Packages
  674. --------
  675.  
  676. Newer versions of source and standard binary packages may be available from
  677. http://ftp.WL0.org or the mirrors listed at http://postfix.WL0.org.  Look
  678. in the appropriate directory according to your distribution.
  679.  
  680. Mailing List
  681. ------------
  682.  
  683. I host a mailing list to announce new packages as they are released. If you
  684. are interested in subscribing take a look at
  685. http://postfix.WL0.org/en/lists/.  Previous announcements are archived.
  686.  
  687. Chrooting
  688. ---------
  689.  
  690. The chroot behaviour of my packages has changed over time. Current
  691. packages will NOT turn on the chroot environment in Postfix.  Older
  692. versions did the opposite.  If you upgrade from an older version
  693. of my package the chroot behaviour will NOT be changed. (Check
  694. %{_sysconfdir}/postfix/master.cf for details.)
  695.  
  696. I have provided a simple script postfix-chroot.sh which attempts to
  697. cover most situations and should enable you to disable or enable the
  698. chroot on your system with little effort.
  699.  
  700. Package Build Options
  701. ---------------------
  702.  
  703. This package can be built on several Linux distributions and with several
  704. optional features.  %{_sysconfdir}/postfix/postfix.spec.cf contains the
  705. information used to build this version of the rpm. It can also
  706. be used to build a new rpm with the same options.
  707.  
  708. Enjoy!
  709.  
  710. Simon J Mudd, <sjmudd@pobox.com>
  711. EOF
  712.  
  713. # generate postfix.spec.cf
  714. # - used to build a newer version of the rpm with the same parameters
  715. #   as the current package.
  716. # - provides build instructions
  717. cat - %{_sourcedir}/postfix.spec.cf <<EOF | sed -e '/^# NOTE:/d' > ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/postfix.spec.cf
  718. #
  719. # This file contains the following information:
  720. #
  721. # - configuration options used to build the installed postfix rpm
  722. #   - generated when the binary rpm was built
  723. #
  724. # - Postfix RPM build instructions
  725. #   - for upgrading the installed rpm with the same options
  726. #   - for building the rpm with other options
  727. #
  728. # 1. CONFIGURATION OPTIONS OF INSTALLED BINARY RPM
  729. #
  730. # Package built on: %{build_dist_full} (%{build_dist})
  731.  
  732. POSTFIX_ALT_PRIO=%{with_alt_prio}
  733. POSTFIX_CDB=%{with_cdb}
  734. POSTFIX_DB=%{requires_db}
  735. POSTFIX_DOVECOT=%{with_dovecot}
  736. POSTFIX_LDAP=%{with_ldap}
  737. POSTFIX_MYSQL=%{with_mysql}
  738. POSTFIX_MYSQL_PATHS=%{mysql_paths}
  739. POSTFIX_MYSQL_REDHAT=%{with_mysql_redhat}
  740. POSTFIX_PCRE=%{with_pcre}
  741. POSTFIX_PGSQL=%{with_pgsql}
  742. POSTFIX_SASL=%{with_sasl}
  743. POSTFIX_SMTPD_MULTILINE_GREETING=%{smtpd_multiline_greeting}
  744. POSTFIX_TLS=%{with_tls}
  745. POSTFIX_VDA=%{with_vda}
  746. POSTFIX_SQLITE=%{with_sqlite}
  747.  
  748. # export values to child processes
  749. export POSTFIX_MYSQL POSTFIX_MYSQL_PATHS POSTFIX_MYSQL_REDHAT \\
  750.  POSTFIX_LDAP POSTFIX_PCRE POSTFIX_PGSQL \\
  751.  POSTFIX_SASL POSTFIX_TLS POSTFIX_VDA \\
  752.  POSTFIX_SMTPD_MULTILINE_GREETING POSTFIX_DB \\
  753.  POSTFIX_INCLUDE_DB POSTFIX_SQLITE \\
  754.  POSTFIX_CDB POSTFIX_ALT_PRIO POSTFIX_DOVECOT
  755.  
  756. # other options used in the build (but not explicitly changeable by the user) are:
  757. # - debug=%{?_with_debug:1}%{?!_with_debug:0}
  758. # - pcre_requires=%{pcre_requires},
  759. # - requires_zlib=%{requires_zlib},
  760. # - sasl_library=%{sasl_library}
  761. # - tlsfix=%{with_tlsfix}
  762. #
  763. # %{_sysconfdir}/postfix/makedefs.out is also produced by the build and may be of
  764. # interest if you are building Postfix by hand.
  765. EOF
  766.  
  767. %post
  768. umask 022
  769.  
  770. chkconfig --add postfix
  771.  
  772. # Upgrade configuration as necessary
  773. sh %{_libexecdir}/postfix/post-install upgrade-package \
  774.         config_directory=%{_sysconfdir}/postfix \
  775.         daemon_directory=%{_libexecdir}/postfix \
  776.         command_directory=%{_sbindir} \
  777.         mail_owner=postfix \
  778.         setgid_group=postdrop \
  779.         html_directory=%{html_dir} \
  780.         manpage_directory=%{_mandir} \
  781.         readme_directory=%{readme_dir} \
  782.         sendmail_path=%{sendmail_path} \
  783.         newaliases_path=%{newaliases_path} \
  784.         mailq_path=%{mailq_path} \
  785. || :
  786.  
  787. %{_sbindir}/postalias %{_sysconfdir}/postfix/aliases
  788. %{_sbindir}/postfix check || :
  789.  
  790. # Add submission to services if not found, required for rh <= 7.0
  791. if ! grep -q ^submission %{_sysconfdir}/services
  792. then
  793. cat <<EOF >>%{_sysconfdir}/services
  794. submission      587/tcp         msa     # mail message submission
  795. submission      587/udp         msa     # mail message submission
  796. EOF
  797. fi
  798.  
  799. # Add smtps to services if not found
  800. if ! grep -q ^smtps %{_sysconfdir}/services
  801. then
  802. cat <<EOF >>%{_sysconfdir}/services
  803. smtps           465/tcp                 # SMTP over SSL (TLS)
  804. EOF
  805. fi
  806.  
  807. # If using sasl create %{_sysconfdir}/sysconfig/saslauthd if necessary
  808. # - this file is provided in some (but not all) cyrus-sasl packages
  809. #   - RHEL3 provides this file in cyrus-sasl >= 2.1.18-2
  810. %if %{with_sasl}
  811. [ -f %{_sysconfdir}/sysconfig/saslauthd ] || {
  812.         grep -v "^# NOTE: " %{_sysconfdir}/sysconfig/saslauthd.postfix > %{_sysconfdir}/sysconfig/saslauthd
  813.         chmod 644 %{_sysconfdir}/sysconfig/saslauthd
  814.         %{whinge} "creating new %{_sysconfdir}/sysconfig/saslauthd from local Postfix copy"
  815. }
  816. %endif
  817.  
  818. # Add comments to the /etc/dovecot.conf configuration file if it exists
  819. # showing how to configure with Postfix if needed.  If postfix is mentioned
  820. # in the dovecot configuration file then DO NOTHING.
  821.  
  822. DOVECOT_CONF=/etc/dovecot.conf
  823. if [ -f $DOVECOT_CONF ] && ! grep -q postfix $DOVECOT_CONF; then
  824.         # Check if auth default is configured and add a COMMENTED SECTION
  825.         # taken from the SASL_README file.
  826.         if grep -q 'auth default' $DOVECOT_CONF; then
  827.                 ed $DOVECOT_CONF <<-EOF_END || exit 1
  828.                 /auth default {
  829.                 a
  830.  
  831.                 # Postfix - suggested configuration taken from SASL_README (2.3.2).
  832.                 #    mechanisms = plain login
  833.                 #  socket listen {
  834.                 #    client {
  835.                 #      path = /var/spool/postfix/private/auth
  836.                 #      mode = 0660
  837.                 #      user = postfix
  838.                 #      group = postfix
  839.                 #    }
  840.                 #  }
  841.        
  842.                 .
  843.                 w
  844.                 q
  845.                 EOF_END
  846.         else
  847.                 # Add the whole section at the end.
  848.                 cat <<-EOF_END >> $DOVECOT_CONF
  849.        
  850.                 # Postfix - suggested configuration taken from SASL_README (2.3.2).
  851.                 #auth default {
  852.                 #  mechanisms = plain login
  853.                 #  passdb pam {
  854.                 #  }
  855.                 #  userdb passwd {
  856.                 #  }
  857.                 #  socket listen {
  858.                 #    client {
  859.                 #      path = /var/spool/postfix/private/auth
  860.                 #      mode = 0660
  861.                 #      user = postfix
  862.                 #      group = postfix
  863.                 #    }
  864.                 #  }
  865.                 #}
  866.        
  867.                 EOF_END
  868.         fi
  869. fi
  870.  
  871. # Apply the alternatives scripts ONLY if installing (not upgrading) to
  872. # ensure a link exists from %{_sbindir}/sendmail to
  873. # %{sendmail_path} (and other files).
  874. #
  875. # If performing an upgrade this MUST be done in the trigger scripts.
  876. # (old postfix packages, pre-alternatives have a /usr/sbin/sendmail and this
  877. # gets removed _AFTER_ the %post stage when the old package is removed)
  878.  
  879. [ "$1" = 1 ] || exit 0
  880.  
  881. # See changelog for explanation of mta-sendmailman entry.
  882. %{_sbindir}/alternatives --install %{_sbindir}/sendmail mta %{sendmail_path} %{with_alt_prio} \
  883.     --slave %{_bindir}/mailq mta-mailq %{mailq_path} \
  884.     --slave %{_bindir}/newaliases mta-newaliases %{newaliases_path} \
  885.     --slave %{_bindir}/rmail mta-rmail %{rmail_path} \
  886.     --slave /usr/lib/sendmail mta-sendmail %{usrlib_sendmail} \
  887.     --slave %{_mandir}/man8/sendmail.8%{mps}   mta-sendmailman   %{_mandir}/man1/sendmail.postfix.1%{mps} \
  888.     --slave %{_mandir}/man1/mailq.1%{mps}      mta-mailqman      %{_mandir}/man1/mailq.postfix.1%{mps} \
  889.     --slave %{_mandir}/man1/newaliases.1%{mps} mta-newaliasesman %{_mandir}/man1/newaliases.postfix.1%{mps} \
  890.     --slave %{_mandir}/man5/aliases.5%{mps}    mta-aliasesman    %{_mandir}/man5/aliases.postfix.5%{mps} \
  891.     --initscript postfix
  892.  
  893. exit 0
  894.  
  895. %triggerpostun -- sendmail
  896.  
  897. # If removing sendmail and not using alternatives: replace with postfix equivalents
  898. %whinge "%{V_postfix}-%{rel} triggerpostun -- sendmail: final number of sendmail packages=$2"
  899. [ $2 = 0 ] || exit 0
  900.  
  901. # See changelog for explanation of mta-sendmailman entry.
  902. %{_sbindir}/alternatives --install %{_sbindir}/sendmail mta %{sendmail_path} %{with_alt_prio} \
  903.     --slave %{_bindir}/mailq mta-mailq %{mailq_path} \
  904.     --slave %{_bindir}/newaliases mta-newaliases %{newaliases_path} \
  905.     --slave %{_bindir}/rmail mta-rmail %{rmail_path} \
  906.     --slave /usr/lib/sendmail mta-sendmail %{usrlib_sendmail} \
  907.     --slave %{_mandir}/man8/sendmail.8%{mps}   mta-sendmailman   %{_mandir}/man1/sendmail.postfix.1%{mps} \
  908.     --slave %{_mandir}/man1/mailq.1%{mps}      mta-mailqman      %{_mandir}/man1/mailq.postfix.1%{mps} \
  909.     --slave %{_mandir}/man1/newaliases.1%{mps} mta-newaliasesman %{_mandir}/man1/newaliases.postfix.1%{mps} \
  910.     --slave %{_mandir}/man5/aliases.5%{mps}    mta-aliasesman    %{_mandir}/man5/aliases.postfix.5%{mps} \
  911.     --initscript postfix
  912. exit 0  # ensure the trigger exit status is 0
  913.  
  914. %triggerpostun -- postfix
  915.  
  916. # If upgrading postfix some versions are pre-alternatives and use
  917. # /usr/sbin/sendmail.  After uninstalling the old package this file will be
  918. # missing and we need to link to the new postfix sendmail binary.
  919. %whinge "%{V_postfix}-%{rel} triggerpostun -- postfix: final number of Postfix packages=$2"
  920. [ $2 -gt 0 ] || exit 0
  921.  
  922. # See changelog for explanation of mta-sendmailman entry.
  923. %{_sbindir}/alternatives --install %{_sbindir}/sendmail mta %{sendmail_path} %{with_alt_prio} \
  924.     --slave %{_bindir}/mailq mta-mailq %{mailq_path} \
  925.     --slave %{_bindir}/newaliases mta-newaliases %{newaliases_path} \
  926.     --slave %{_bindir}/rmail mta-rmail %{rmail_path} \
  927.     --slave /usr/lib/sendmail mta-sendmail %{usrlib_sendmail} \
  928.     --slave %{_mandir}/man8/sendmail.8%{mps}   mta-sendmailman   %{_mandir}/man1/sendmail.postfix.1%{mps} \
  929.     --slave %{_mandir}/man1/mailq.1%{mps}      mta-mailqman      %{_mandir}/man1/mailq.postfix.1%{mps} \
  930.     --slave %{_mandir}/man1/newaliases.1%{mps} mta-newaliasesman %{_mandir}/man1/newaliases.postfix.1%{mps} \
  931.     --slave %{_mandir}/man5/aliases.5%{mps}    mta-aliasesman    %{_mandir}/man5/aliases.postfix.5%{mps} \
  932.     --initscript postfix
  933. exit 0  # ensure the trigger exit status is 0
  934.  
  935. %preun
  936. umask 022
  937.  
  938. # remove the directory and depth levels of subdirectories
  939.  
  940. queue_hash_depth_remove () {
  941.     local dir=$1
  942.     local depth=$2
  943.     local new_depth
  944.     local a
  945.     [ -d "$dir" ] && {
  946.         if [ "$depth" -gt 0 ]; then
  947.             new_depth=$(($depth - 1))
  948.             for a in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
  949.                 test -d $dir/$a && queue_hash_depth_remove $dir/$a $new_depth
  950.             done
  951.         fi
  952.         rm -f $dir/*
  953.         rmdir $dir || %whinge "WARNING: preun - unable to remove directory %{_var}/spool/postfix/$dir"
  954.     }
  955. }
  956.  
  957. # remove the rest of the queue directory structure
  958. queue_directory_remove () {
  959.     # remove the hashed directories
  960.     depth=$(postconf -h hash_queue_depth)
  961.     for dir in $(postconf -h hash_queue_names | sed -e 's/,/\n/g; s/ //g'); do
  962.         queue_hash_depth_remove $dir $depth
  963.     done
  964.  
  965.     # now remove the other directories
  966.     for dir in corrupt hold maildrop pid private public saved; do
  967.         queue_hash_depth_remove $dir 0
  968.     done
  969. }
  970.  
  971. # No more postfix packages left so prepare to finish package removal.
  972. # _In theory_ there is no chroot environment now, so there is no need to
  973. # clean it out.
  974. # However it may be prudent later to add back a call to
  975. # /etc/postfix/postfix-chroot.sh disable
  976. # just to make sure, but won't do this yet. (If you think I should let
  977. # me know).
  978. if [ "$1" = 0 ]; then
  979.     service postfix stop >/dev/null 2>&1
  980.     chkconfig --del postfix
  981.  
  982.     %{_sbindir}/alternatives --remove mta %{sendmail_path}
  983.  
  984.     # userdel also deletes the user's group
  985.     %{_sbindir}/userdel postfix   || %whinge "WARNING: failed to remove user postfix"
  986.     %{_sbindir}/groupdel postdrop || %whinge "WARNING: failed to remove group postdrop"
  987.  
  988.     cd %{_var}/spool/postfix && queue_directory_remove
  989. fi
  990.  
  991. exit 0
  992.  
  993. %postun
  994. umask 022
  995. if [ "$1" -ge 1 ]; then
  996.     service postfix condrestart || :
  997.     # don't use readlink as this is not available on rh73
  998.     mta=`[ -L /etc/alternatives/mta ] && ls -la /etc/alternatives/mta | awk '{ print $11 }'`
  999.     if [ "$mta" = "%{sendmail_path}" ]; then
  1000.         %{_sbindir}/alternatives --set mta %{sendmail_path}
  1001.     fi
  1002. fi
  1003. exit 0
  1004.  
  1005. %clean
  1006. umask 022
  1007. [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ] && {
  1008.     rm -rf ${RPM_BUILD_ROOT}
  1009. } || :
  1010.  
  1011. %files
  1012. %defattr(-, root, root)
  1013.  
  1014. %if %{with_sasl}
  1015. %config(noreplace) %{sasl_lib_dir}/smtpd.conf
  1016. %config(noreplace) %{_sysconfdir}/pam.d/smtp.postfix
  1017. %config(noreplace) %{_sysconfdir}/sysconfig/saslauthd.postfix
  1018. %endif
  1019.  
  1020. %verify(not md5 size mtime) %config %dir %{_sysconfdir}/postfix
  1021. %attr(0644, root, root)         %{_sysconfdir}/postfix/LICENSE
  1022. %attr(0644, root, root)         %{_sysconfdir}/postfix/TLS_LICENSE
  1023. %attr(0444, root, root) %config %{_sysconfdir}/postfix/makedefs.out
  1024. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/main.cf
  1025. %attr(0644, root, root)                                                %{_sysconfdir}/postfix/main.cf.default
  1026. %attr(0644, root, root)                                                %{_sysconfdir}/postfix/bounce.cf.default
  1027. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/master.cf
  1028. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/access
  1029. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/aliases
  1030. %attr(0644, root, root) %verify(not md5 size mtime) %ghost             %{_sysconfdir}/postfix/aliases.db
  1031. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/canonical
  1032. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/generic
  1033. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/header_checks
  1034. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/relocated
  1035. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/transport
  1036. %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/postfix/virtual
  1037.  
  1038. %attr(0755, root, root) %config %{_libexecdir}/postfix/postfix-script
  1039. %attr(0755, root, root)         %{_libexecdir}/postfix/postfix-wrapper
  1040. %attr(0755, root, root)         %{_libexecdir}/postfix/postmulti-script
  1041. %attr(0755, root, root) %config %{_libexecdir}/postfix/post-install
  1042. %attr(0644, root, root)         %{_libexecdir}/postfix/postfix-files
  1043. %attr(0644, root, root)         %{_libexecdir}/postfix/main.cf
  1044. %attr(0644, root, root)         %{_libexecdir}/postfix/master.cf
  1045.  
  1046. %attr(0644, root, root) %{_sysconfdir}/postfix/README.rpm
  1047. %attr(0644, root, root) %{_sysconfdir}/postfix/postfix.spec.cf
  1048.  
  1049. # convenience links
  1050. %{_sysconfdir}/postfix/html
  1051. %{_sysconfdir}/postfix/readme
  1052. %{_sysconfdir}/postfix/examples
  1053.  
  1054. %attr(0755, root, root) %{_sysconfdir}/postfix/postfix-chroot.sh
  1055.  
  1056. %attr(0755, root, root) %config %{initdir}/postfix
  1057.  
  1058. %dir                      %verify(not md5 size mtime) %{_var}/spool/postfix
  1059.  
  1060. # For correct directory permissions check postfix-install script
  1061. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/active
  1062. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/bounce
  1063. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/corrupt
  1064. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/defer
  1065. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/deferred
  1066. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/flush
  1067. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/hold
  1068. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/incoming
  1069. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/private
  1070. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/spool/postfix/saved
  1071. %dir %attr(0730, postfix, postdrop) %verify(not md5 size mtime) %{_var}/spool/postfix/maildrop
  1072. %dir %attr(0710, postfix, postdrop) %verify(not md5 size mtime) %{_var}/spool/postfix/public
  1073. %dir %attr(0755, root, root)        %verify(not md5 size mtime) %{_var}/spool/postfix/pid
  1074. %dir %attr(0700, postfix, root)     %verify(not md5 size mtime) %{_var}/lib/postfix
  1075.  
  1076. %doc %{docdir}/LICENSE
  1077. %doc %{docdir}/IPv6-ChangeLog
  1078. %doc %{docdir}/AAAREADME
  1079. %doc %{docdir}/COMPATIBILITY
  1080. %doc %{docdir}/COPYRIGHT
  1081. %doc %{docdir}/HISTORY
  1082. %doc %{docdir}/PORTING
  1083. %doc %{docdir}/RELEASE_NOTES
  1084. %doc %{docdir}/RELEASE_NOTES-1.0
  1085. %doc %{docdir}/RELEASE_NOTES-1.1
  1086. %doc %{docdir}/RELEASE_NOTES-2.0
  1087. %doc %{docdir}/RELEASE_NOTES-2.1
  1088. %doc %{docdir}/RELEASE_NOTES-2.2
  1089. %doc %{docdir}/RELEASE_NOTES-2.3
  1090. %doc %{docdir}/RELEASE_NOTES-2.4
  1091. %doc %{docdir}/RELEASE_NOTES-2.5
  1092. %doc %{docdir}/RELEASE_NOTES-2.6
  1093. %doc %{docdir}/RELEASE_NOTES-2.7
  1094. #%doc %{docdir}/RELEASE_NOTES-2.8
  1095. %doc %{docdir}/SEE_ALSO
  1096. %doc %{docdir}/TLS_ACKNOWLEDGEMENTS
  1097. %doc %{docdir}/TLS_CHANGES
  1098. %doc %{docdir}/TLS_LICENSE
  1099. %doc %{docdir}/TLS_TODO
  1100. #%doc %{docdir}/WISHLIST
  1101. %doc %{docdir}/US_PATENT_6321267
  1102.  
  1103. %doc %dir %{readme_dir}
  1104. %doc %{readme_dir}/*
  1105. %doc %dir %{html_dir}
  1106. %doc %{html_dir}/*
  1107. %doc %dir %{examples_dir}
  1108. %doc %dir %{examples_dir}/chroot-setup
  1109. %dir %dir %{examples_dir}/qmail-local
  1110. %dir %dir %{examples_dir}/smtpd-policy
  1111. %doc %{examples_dir}/chroot-setup/*
  1112. %doc %{examples_dir}/qmail-local/*
  1113. %doc %{examples_dir}/smtpd-policy/*
  1114.  
  1115. %dir %attr(0755, root, root) %verify(not md5 size mtime) %{_libexecdir}/postfix
  1116. %{_libexecdir}/postfix/anvil
  1117. %{_libexecdir}/postfix/bounce
  1118. %{_libexecdir}/postfix/cleanup
  1119. %{_libexecdir}/postfix/discard
  1120. %{_libexecdir}/postfix/error
  1121. %{_libexecdir}/postfix/flush
  1122. %{_libexecdir}/postfix/lmtp
  1123. %{_libexecdir}/postfix/local
  1124. %{_libexecdir}/postfix/master
  1125. %{_libexecdir}/postfix/nqmgr
  1126. %{_libexecdir}/postfix/oqmgr
  1127. %{_libexecdir}/postfix/pickup
  1128. %{_libexecdir}/postfix/pipe
  1129. %{_libexecdir}/postfix/proxymap
  1130. %{_libexecdir}/postfix/qmgr
  1131. %{_libexecdir}/postfix/qmqpd
  1132. # including as installed by Wietse even with -DNO_TLS ?
  1133. %{_libexecdir}/postfix/scache
  1134. %{_libexecdir}/postfix/showq
  1135. %{_libexecdir}/postfix/smtp
  1136. %{_libexecdir}/postfix/smtpd
  1137. %{_libexecdir}/postfix/spawn
  1138. # including as installed by Wietse even with -DNO_TLS ?
  1139. %{_libexecdir}/postfix/tlsmgr
  1140. %{_libexecdir}/postfix/trivial-rewrite
  1141. %{_libexecdir}/postfix/verify
  1142. %{_libexecdir}/postfix/virtual
  1143. # 2.9.0 feature dnsblog postscreen tlsproxy                                                                                                            
  1144. %{_libexecdir}/postfix/dnsblog                                                                                                                              
  1145. %{_libexecdir}/postfix/postscreen                                                                                                                          
  1146. %{_libexecdir}/postfix/tlsproxy
  1147.  
  1148. %{_sbindir}/postalias
  1149. %{_sbindir}/postcat
  1150. %{_sbindir}/postconf
  1151. %attr(2755,root,postdrop) %{_sbindir}/postdrop
  1152. %attr(2755,root,postdrop) %{_sbindir}/postqueue
  1153. %{_sbindir}/postfix
  1154. %{_sbindir}/postkick
  1155. %{_sbindir}/postlock
  1156. %{_sbindir}/postlog
  1157. %{_sbindir}/postmap
  1158. %{_sbindir}/postmulti
  1159. %{_sbindir}/postsuper
  1160.  
  1161. %{_sbindir}/smtp-sink
  1162. %{_sbindir}/smtp-source
  1163. %{_sbindir}/qmqp-source
  1164.  
  1165. %{sendmail_path}
  1166. %{mailq_path}
  1167. %{newaliases_path}
  1168. %{usrlib_sendmail}
  1169. %attr(0755, root, root) %{rmail_path}
  1170. %attr(0755, root, root) %{_bindir}/postfinger
  1171. %attr(0755, root, root) %{_sbindir}/qshape
  1172.  
  1173. %{_mandir}/*/*
  1174.  
  1175. ##############################################################################
  1176. # List of changes made to this package.
  1177. #
  1178. # Although old entries from the changelog have been removed most of them
  1179. # are available from my CVS repository of changes made to this file.
  1180. #
  1181.  
  1182. %changelog
  1183.  
  1184. * Tue Feb 23 2010 Simon J Mudd <sjmudd@pobox.com> 2.7.0-1
  1185.   - update to 2.7.0 based on work by Hari Hendaryanto <hari.h@csmcom.com>
  1186.     see http://www.kutukupret.com/2010/02/08/compiling-postfix-2-7-0-as-rpm-package/
  1187.  
  1188. * Wed Sep 02 2009 Simon J Mudd <sjmudd@pobox.com> 2.6.5-1
  1189.   - upgrade to 2.6.5
  1190.  
  1191. * Sun May 24 2009 Simon J Mudd <sjmudd@pobox.com> 2.6.1-1
  1192.   - upgrade to 2.6.1
  1193.  
  1194. * Sun May 24 2009 Simon J Mudd <sjmudd@pobox.com> 2.6.0-1
  1195.   - upgrade to 2.6.0