Well guys, I gave it a whirl by commenting out the following lines in the spec:
%if %{with_mysql}
Requires: MySQL-shared
BuildRequires: MySQL-shared, MySQL-devel
%endif
And I was able to build the rpm and it looks good!
[root at beta x86_64]# ldd $(which postfix) | grep -i mysql
libmysqlclient.so.18 => /usr/lib64/mysql/libmysqlclient.so.18
(0x00002ae575b3b000)
Wish me luck!
:)
tim
On Sat, Mar 24, 2012 at 10:32 PM, Tim Dunphy <bluethundr at gmail.com>
wrote:> hello list,
>
> ?I'm trying to build a postfix rpm that has mysql support included.
> I've found the line where I need to define mysql support but it seems
> that I am being tripped up by some build dependencies:
>
> ?[root at beta SPECS]# rpmbuild -ba postfix.spec
> error: Failed build dependencies:
> ? ? ? ?MySQL-shared is needed by postfix-2.9.1-1.rhel5.x86_64
> ? ? ? ?MySQL-devel is needed by postfix-2.9.1-1.rhel5.x86_64
>
>
>
> This is the line I've enabled in the space file in order to include
> mysql support
>
> %define with_mysql ? ? ? ?1
>
> and this is the line in the spec that seems to pertain to the error:
>
> %if %{with_mysql}
> Requires: MySQL-shared
> BuildRequires: MySQL-shared, MySQL-devel
> %endif
>
> What I'm wondering is if I comment out the lines that require
> MySQL-shared and MySQL-devel will I end up with a usable install of
> postfix with MySQL support?
>
> Here is the spec file that I am trying to use:
>
> ============>
> # W A R N I N G -- DO NOT EDIT THIS FILE -- W A R N I N G
> #
> # postfix.spec
> #
> # This file was generated automatically from
> /home/sjmudd/RPM/SRC/postfix/postfix.spec.in.
> # If you want to build postfix with other options see make-postfix.spec in
> # the same directory for instructions.
> # --
> # Note: For complete source info for building these rpms see:
> # ? ? ? ? ?https://github.com/sjmudd/postfix-rpm
> #
> # File used to generate the distribution-specific postfix.spec file.
> # If you need to make changes to postfix.spec, make them to postfix.spec.in
> # and regenerate the spec file.
> #
> # See make-postfix.spec in %{_sourcedir} for more information.
> #
> # This spec file was built on distribution: rhel-5.0
> #
> # Information imported from postfix.spec.in: DO NOT CHANGE IT BY HAND
> #
> # mysql_paths ? ? ? ? ? ? ?- paths where locally installed MySQL resides
(or 0)
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ?- if using this option mysql_paths should be
as
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?follows:
> </pathto/mysql/include>:</pathto/mysql/lib>
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?e.g.: ? ?/usr/mysql/include:/usr/mysql/lib
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ?- The order is important and only 2
directories may
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?be given.
> # requires_db ? ? ? ? ? ? ?- used to add dbX dependencies in the package
> # smtpd_multiline_greeting - my patch to allow multiline banner
> # mps ? ? ? ? ? ? ? ? ? ? ?- man page suffix, .gz except Mandrake >= 8
which uses .bz2
> # with_cdb ? ? ? ? ? ? ? ? - include CDB support by Michael Tokarev
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ?<mjt at corpit.ru>
> # with_dovecot ? ? ? ? ? ? - include DOVECOT SASL authentication
> # with_ldap ? ? ? ? ? ? ? ?- include LDAP support
> # with_mysql ? ? ? ? ? ? ? - include support for www.mysql.com's MySQL
rpms
> # with_mysql_redhat ? ? ? ?- include support for RedHat's MySQL rpms
> # with_pcre ? ? ? ? ? ? ? ?- include pcre support
> # with_pgsql ? ? ? ? ? ? ? - include Postgres database support
> # with_sasl ? ? ? ? ? ? ? ?- include Cyrus SASL/AUTH support (0 to disable
sasl,
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ?1 for sasl v1, or 2 for sasl v2, sasl_library
is
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ?the sasl library to link against,
> distribution dependent)
> # with_spf ? ? ? ? ? ? ? ? - include libspf2 library support (EXPERIMENTAL)
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ?- rpms for libspf can be found at
> http://www.sosdg.org/rpm/libspf/
> # with_tls ? ? ? ? ? ? ? ? - include TLS support
> # with_tlsfix ? ? ? ? ? ? ?- include TLS fix
> # ? ? ? ? ? ? ? ? ? ? ? ? ? ?- needed for rh6.2, rh9 and rhel3
> # with_vda ? ? ? ? ? ? ? ? - add virtual delivery agent patch
> #
> # Please send bugfixes and comments to the packager.
> #
> # distribution which the spec file was built from
> %define distribution rhel-5.0
>
> # distribution which we are building Postfix on
> # - call my script once to speed up build process
> %define distro_info ? ? %(sh $(rpm --eval
> '%{_sourcedir}')/postfix-get-distribution --distro-info)
> %define build_dist_full %(echo "%distro_info" | cut -d"
" -f5)
> %define build_name ? ? ?%(echo "%distro_info" | cut -d"
" -f1)
> %define build_major ? ? %(echo "%distro_info" | cut -d"
" -f3)
> %define build_minor ? ? %(echo "%distro_info" | cut -d"
" -f4)
> %define build_dist ? ? ?%{build_name}-%{build_major}.%{build_minor}
> %define mps %(test "%{build_name}" = mandrake -a
"%{build_major}" -ge
> 8 && echo .bz2 || echo .gz)
>
> %define mysql_paths 0
> %define mysql_local %(test "%{mysql_paths}" != 0 && echo
1 || echo 0)
> %define mysql_include %(echo "%{mysql_paths}" | cut -d: -f1)
> %define mysql_lib %(echo "%{mysql_paths}" | cut -d: -f2)
> # determine PCRE library based on distribution name
> %define pcre_requires %(test %{build_dist} = mandrake && echo
libpcre0
> || echo pcre)
> # determine SASL library based on distribution name
> %define sasl_library %(test %{build_dist} = mandrake && echo
> libsasl-devel || echo cyrus-sasl-devel)
> %define requires_db 4
> %define requires_zlib 1
> %define smtpd_multiline_greeting 1
>
> # alternatives priority can now be changed in one place.
> # - this used to be 30 but RH seems to have defined other higher values
> # ? and some users need another value.
> # ? Don't change this unless you really think you need to.
> %define with_alt_prio ? ? 30
>
> %define with_cdb ? ? ? ? ?0
> %define with_ldap ? ? ? ? 0
> %define with_mysql ? ? ? ?1
> %define with_mysql_redhat 1
> %define with_pcre ? ? ? ? 0
> %define with_pgsql ? ? ? ?0
> %define with_sasl ? ? ? ? 0
> %define with_spf ? ? ? ? ?0
> %define with_dovecot ? ? ?0
> %define with_tls ? ? ? ? ?1
> %define with_tlsfix ? ? ? 2
> %define with_vda ? ? ? ? ?1
>
> # support the conditional builds via rpm's --with debug
> %define debug %{?_with_debug:1}%{?!_with_debug:0}
>
> # patch and version information
> %define V_vda ? ? ? ?2.5.4
> %define V_cdb ? ? ? ?1.1.11-20021104
> %define V_postfinger 1.30
>
> # If set to 1 if official version, 0 if snapshot
> %define official 1
> %define V_postfix 2.9.1
> %define rel 1.rhel5
> %if %{official}
> %define V_tarball %{V_postfix}
> %define ftp_dir official
> %else
> %define V_release_date RC2
> %define V_tarball %{V_postfix}-%{V_release_date}
> %define ftp_dir experimental
> %endif
> # rpm does not accept '-' in version strings so replace them with a
'.'
> # - (only affects snapshots)
> %define V_package %(echo %{V_tarball} | sed 's/-/./g')
>
> # rpm-workaround:
> #
> # We can NOT use %{_docdir}/%{name}-%{version} for installing the docs
> # from the 'install' section as RPM kindly removes this directory
after
> # we have installed files to it. (standard part of 'doc'
processing!)
> #
> #define docdir %{_docdir}/%{name}-%{version}
> %define docdir %{_docdir}/%{name}-%{V_package}-documentation
> %define readme_dir ? %{docdir}/README_FILES
> %define html_dir ? ? %{docdir}/html
> %define examples_dir %{docdir}/examples
>
> %define newaliases_path %{_bindir}/newaliases.postfix
> %define mailq_path %{_bindir}/mailq.postfix
> %define rmail_path %{_bindir}/rmail.postfix
> %define sendmail_path %{_sbindir}/sendmail.postfix
> # Don't use %{_libdir} as it gives the wrong directory on x86_64
servers
> %define usrlib_sendmail /usr/lib/sendmail.postfix
>
> %define initdir /etc/rc.d/init.d
>
> %define whinge /usr/bin/logger -p mail.info -t postfix/rpm
> %define die_cmd die(){ %whinge "$*"; exit 1; }
>
> Name: postfix
> Group: System Environment/Daemons
> URL: http://www.postfix.org
> License: IBM Public License
> PreReq: chkconfig, initscripts, shadow-utils
> PreReq: /etc/init.d, /sbin/service, chkconfig >= 1.3
> Epoch: 2
>
> Provides: MTA smtpd smtpdaemon
> Provides: %{_sbindir}/sendmail %{_bindir}/mailq %{_bindir}/newaliases
> %{_bindir}/rmail
> Provides: %{_mandir}/man1/newaliases.1.%{mps}
> %{_mandir}/man5/newaliases.5.%{mps}
>
> Version: %{V_package}
> Release: %{rel}
> Packager: Simon J Mudd <sjmudd at pobox.com>
> Summary: Postfix Mail Transport Agent
> Vendor: Built on %{build_dist_full} (%{build_dist})
> Source0:
ftp://ftp.porcupine.org/mirrors/postfix-release/%{ftp_dir}/postfix-%{V_tarball}.tar.gz
> Source1: make-postfix.rpm
> Source2: postfix-get-distribution
> Source3: postfix-etc-init.d-postfix
> Source4: postfix-chroot.sh
> Source5: postfix-aliases
> Source7: postfix.spec.in
> Source8: make-postfix.spec
> Source10: README-Postfix-SASL-RedHat.txt
> Source12: ftp://ftp.corpit.ru/pub/postfix/postfix-dict_cdb-%{V_cdb}.tar.gz
> Source16: http://postfix.wl0.org/ftp/postfinger/postfinger-%{V_postfinger}
>
> # Sources >= 100 are config files
> Source100: postfix-sasl.conf
> Source101: postfix-pam.conf
> Source102: postfix-saslauthd.conf
>
> # Obligatory Patches
> Patch0: postfix-2.3.3-vda.patch
> Patch3: postfix-files.patch
> Patch5: postfix-makedefs.patch
>
> # Optional patches
> # FIXME: There is also a 64-bit patch (not included) for 2.5.4
> Patch4: ?http://vda.sourceforge.net/VDA/postfix-%{V_vda}-vda-ng.patch.gz
>
> # SPF patch
> Patch8:
?http://www.linuxrulz.org/nkukard/postfix/postfix-2.3/postfix-2.3.2_libspf2-1.2.x-20060819.patch
> Patch99: ftp://ftp.wl0.org/SOURCES/postfix-2.8.3-multiline-greeting.patch
>
> BuildRoot: %{_tmppath}/%{name}-%{V_package}-buildroot
>
> # Determine packaging requirements
> BuildRequires: /usr/bin/cc, gawk, sed, ed, patch, rpm >= 4
> Requires: gawk, sed, ed
>
> %if %{with_spf}
> BuildRequires: libspf2-devel >= 1.2.5
> Requires: libspf2 >= 1.2.5
> %endif
>
> %if %{requires_db}
> Requires: db%{requires_db}
> BuildRequires: db%{requires_db}-devel
> %endif
>
> %if %{with_cdb}
> Requires: tinycdb
> BuildRequires: tinycdb
> %endif
>
> %if %{with_ldap}
> Requires: openldap >= 1.2.9
> BuildRequires: openldap-devel >= 1.2.9
> %endif
>
> %if %{with_pcre}
> Requires: %{pcre_requires}
> BuildRequires: %{pcre_requires}, %{pcre_requires}-devel
> %endif
>
> # Needed by some Mysql and some TLS packages
> %if %{requires_zlib}
> Requires: zlib
> BuildRequires: zlib-devel
> %endif
>
> %if %{with_mysql_redhat}
> Requires: mysql
> BuildRequires: mysql, mysql-devel
> %endif
>
> %if %{mysql_local}
> BuildRequires: %{mysql_include}/mysql.h
> Requires: %{mysql_lib}/libmysqlclient.so
> %endif
>
> %if %{with_mysql}
> Requires: MySQL-shared
> BuildRequires: MySQL-shared, MySQL-devel
> %endif
>
> %if %{with_pgsql}
> Requires: postgresql-libs
> BuildRequires: postgresql-devel
> %endif
>
> %if %{with_sasl}
> Requires: cyrus-sasl
> BuildRequires: cyrus-sasl, %{sasl_library}
> %endif
>
> # Postfix compiled with Dovecot support only works with dovecot >= 1
> # - however requiring the dovecot rpm to be installed when it may
> # ? not be used means that there will be NO explicit dependency
> # ? added to the rpm.
> %if %{with_dovecot}
> #Requires: dovecot >= 1 ? ? ? ? NOT REQUIRED / DO NOT ADD
> %endif
>
> %if %{with_tls}
> Requires: openssl
> BuildRequires: openssl-devel
> %endif
>
> %description
> Postfix is a Mail Transport Agent (MTA), intended to be an alternative
> to the widely-used sendmail. ?This package includes optional support for
> LDAP, pcre, mysql, SMTP AUTH (SASL) and TLS.
>
> See http://www.redhat.com/support/docs/faqs/RH-postfix-FAQ/book1.html,
> a slightly outdated FAQ, which covers the steps involved in installing
> and configuring postfix.
>
> The binary and source rpms I produce are currently available at
> ? ? ? ?http://postfix.WL0.org, ftp://ftp.WL0.org
> and the mirrors which can be found at the following URL:
> ? ? ? ?http://postfix.WL0.org/en/mirrors/
>
> This package/specfile was built from postfix.spec.in.
> To see the build options used to build this package see the file
> %{_sysconfdir}/postfix/postfix.spec.cf
>
> To use postfix with alternative options download the source package and
> rebuild the binary package following the instructions in the source
> package or on my web page.
>
> %prep
> umask 022
>
> %{die_cmd}
>
> # check custom MYSQL path values are sensible to avoid problems
> # with people mixing include and lib directories
> if [ "%{mysql_paths}" != 0 ]; then
> ? ? ? ?exit_error() {
> ? ? ? ? ? ? ? ?cat <<-EOF
> ? ? ? ? ? ? ?
?*************************************************************************
> ? ? ? ? ? ? ? ?CUSTOM MYSQL configuration error
> ? ? ? ? ? ? ? ?mysql_paths=%mysql_paths ? ? ? ?(0=Not used)
> ? ? ? ? ? ? ? ?mysql_local=%mysql_local ? ? ? ?(0=Not used,1=used)
> ? ? ? ? ? ? ? ?mysql_include=%mysql_include ? ?(include directory)
> ? ? ? ? ? ? ? ?mysql_lib=%mysql_lib ? ? ? ? ? ?(lib directory)
> ? ? ? ? ? ? ? ?ERROR: $1
> ? ? ? ? ? ? ? ? ? ? ? ?If you don't want to use a custom mysql
installation set
> ? ? ? ? ? ? ? ? ? ? ? ?mysql_paths to 0.
> ? ? ? ? ? ? ?
?*************************************************************************
> ? ? ? ? ? ? ? ?EOF
> ? ? ? ? ? ? ? ?exit 1
> ? ? ? ?}
> ? ? ? ?[ $(echo "%{mysql_paths}" | awk -F: '{ print NF
}') = 2 ] || \
> ? ? ? ? ? ? ? ?exit_error "mysql_paths should be of the form
> /pathto/mysql/include:/pathto/mysql/lib, with only 2 directories"
> ? ? ? ?echo "%{mysql_include}" | grep -q "/lib"
&& \
> ? ? ? ? ? ? ? ?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)"
> ? ? ? ?echo "%{mysql_lib}" | grep -q "/include"
&& \
> ? ? ? ? ? ? ? ?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)"
> fi
>
> # Warn if the distribution this spec file was made for isn't the same
as
> # the current distribution, using a script in the SOURCES directory.
> # This will be removed and built into the spec file later.
>
> distribution=$(sh $(rpm --eval
'%{_sourcedir}')/postfix-get-distribution)
>
> if [ "${distribution}" != "%{distribution}" ]; then
> ? ?cat <<ENDTEXT
> ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
>
> This postfix.spec file may not work correctly.
> It was built for %{distribution}, while you are running ${distribution}.
>
> Please rebuild postfix.spec for your distribution by following the
> instructions in postfix.spec.cf.
>
> If this procedure does not allow you to produce a working package, please
> let me know.
>
> ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
> ENDTEXT
> ? ? ? ?exit 1
> fi
>
> %setup -q -n postfix-%{V_tarball}
>
> # Apply obligatory patches
> %patch3 -p1 -b .alternatives
> %patch5 -p1 -b .notls
>
> # Apply optional patches
> %if %{with_cdb}
> %setup -n postfix-%{V_tarball} -D -T -a 12
> sh dict_cdb.sh
> %endif
>
> %if %{with_vda}
> ?test -e ?%{_sourcedir}/postfix-%{V_vda}-vda-ng.patch.gz && \
> ?gzip -dc %{_sourcedir}/postfix-%{V_vda}-vda-ng.patch.gz | patch -p1
> -b --suffix .vda -s || \
> ? ?die "POSTFIX RPM: %{_sourcedir}/postfix-%{V_vda}-vda.patch.gz not
> found or patch failed"
> %endif
>
> %if %{smtpd_multiline_greeting}
> %patch99 ?-p1 -b .multiline
> %endif
>
> %if %{with_spf}
> %patch8 -p1 -b .spf
> %endif
>
> # Modify master.cf: rmail --> rmail.postfix
> ed conf/master.cf <<EOF || exit 1
> H
> ,s/rmail/rmail.postfix/
> w
> q
> EOF
>
> %build
> umask 022
>
> CCARGS> AUXLIBS>
> %ifarch s390 s390x ppc
> CCARGS="${CCARGS} -fsigned-char"
> %endif
>
> %if %{with_cdb}
> ?CCARGS="${CCARGS} -DHAS_CDB"
> ?AUXLIBS="${AUXLIBS} -lcdb"
> %endif
>
> %if %{with_ldap}
> ?CCARGS="${CCARGS} -DHAS_LDAP"
> ?AUXLIBS="${AUXLIBS} -L/usr/%{_lib} -lldap -llber"
> %endif
>
> %if %{with_pcre}
> ?# -I option required for pcre 3.4 (and later?)
> ?CCARGS="${CCARGS} -DHAS_PCRE -I/usr/include/pcre"
> ?AUXLIBS="${AUXLIBS} -lpcre"
> %else
> ?# we need to explicitly disable pcre unless asked for, otherwise it will
> ?# be included if present on the build system. This may cause problems.
> ?CCARGS="${CCARGS} -DNO_PCRE"
> %endif
>
> # Postfix compiles without needing zlib on RedHat's mysql package, but
> # requires zlib when using MySQL's package or if using a locally
installed
> # MySQL binary.
> %if %{with_mysql} || %{with_mysql_redhat}
> ?CCARGS="${CCARGS} -DHAS_MYSQL -I/usr/include/mysql"
> ?AUXLIBS="${AUXLIBS} -L/usr/%{_lib}/mysql -lmysqlclient -lm"
> %endif
>
> %if %{mysql_local}
> ?CCARGS="${CCARGS} -DHAS_MYSQL -I%{mysql_include}"
> ?AUXLIBS="${AUXLIBS} -L%{mysql_lib} -lmysqlclient -lm"
> %endif
>
> %if %{with_pgsql}
> ?CCARGS="${CCARGS} -DHAS_PGSQL -I/usr/include/pgsql"
> ?AUXLIBS="${AUXLIBS} -lpq -lcrypt"
> %endif
>
> %if %{with_sasl}
> ?if [ "%{with_sasl}" -le 1 ]; then
> ? ?%define sasl_lib_dir %{_libdir}/sasl
> ? ?CCARGS="${CCARGS} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL"
> ? ?AUXLIBS="${AUXLIBS} -L%{sasl_lib_dir} -lsasl"
> ?else
> ? ?%define sasl_lib_dir %{_libdir}/sasl2
> ? ?CCARGS="${CCARGS} -I/usr/include/sasl -DUSE_SASL_AUTH
-DUSE_CYRUS_SASL"
> ? ?AUXLIBS="${AUXLIBS} -L%{sasl_lib_dir} -lsasl2"
> ?fi
> %endif
>
> # Provide support for Dovecot SASL
> %if %{with_dovecot}
> ?CCARGS="${CCARGS} -DUSE_SASL_AUTH"
> ?# make dovecot the default IFF we don't include SASL
> ?if [ "%{with_sasl}" = 0 ]; then
> ? ?CCARGS="${CCARGS}
-DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
> ?fi
> %endif
>
> %if %{with_spf}
> ? ?AUXLIBS="${AUXLIBS} -lspf2"
> ? ?CCARGS="${CCARGS} -DHAVE_NS_TYPE"
> %endif
>
> %if %{with_tls}
> # See http://www.openldap.org/lists/openldap-devel/200105/msg00008.html
> # - rh6.2 needs LIBS=-ldl to build correctly.
> # - reported by Jauder Ho <jauderho at carumba.com>
> ?if pkg-config openssl; then
> ? ?CCARGS="${CCARGS} -DUSE_TLS $(pkg-config --cflags openssl)"
> ? ?AUXLIBS="${AUXLIBS} $(pkg-config --libs openssl)"
> ?else
> ? ?#
> ? ?# CHECK THIS - these lines may no longer be needed (required for
> external TLS patch)
> ? ?#
> ? ?[ "%{with_tlsfix}" = 1 ] && LIBS=-ldl
> ? ?[ "%{with_tlsfix}" = 2 ] && CCARGS="${CCARGS}
-I/usr/kerberos/include"
> ? ?CCARGS="${CCARGS} -DUSE_TLS -I/usr/include/openssl"
> ? ?AUXLIBS="${AUXLIBS} -lssl -lcrypto"
> ?fi
> %else
> # explicitly disable TLS otherwise will be built on machine if
> # openssl is available
> ? ? ? ?CCARGS="${CCARGS} -DNO_TLS"
> %endif
>
> # Required by some TLS implementations (RHEL 3 and RH9) and also some MySQL
> # packages
> %if %{requires_zlib}
> ?AUXLIBS="${AUXLIBS} -lz"
> %endif
>
> export CCARGS AUXLIBS
> make -f Makefile.init makefiles
> unset CCARGS AUXLIBS
> # -Wno-comment needed due to large number of warnings on RHEL5
> # suggestion by Eric Hoeve <eric at ehoeve.com>
> make DEBUG="%{?_with_debug:-g}" OPT="$RPM_OPT_FLAGS
-Wno-comment"
>
> %pre
> umask 022
>
> # create postfix user and group, and maildrop group if necessary.
> # Use perl rather than looking in /etc/passwd or /etc/group as this works
> # in a wider NIS or LDAP environment
>
> /usr/bin/getent group postdrop >/dev/null || {
> ? ?%whinge "Adding postdrop group to system"
> ? ?%{_sbindir}/groupadd -r postdrop
> }
>
> /usr/bin/getent group postfix >/dev/null || {
> ? ?%whinge "Adding postfix group to system"
> ? ?%{_sbindir}/groupadd -r postfix
> }
>
> /usr/bin/getent passwd postfix >/dev/null || {
> ? ?%whinge "Adding postfix user to system"
> ? ?%{_sbindir}/useradd -d %{_var}/spool/postfix -s /bin/true -g
> postfix -G mail -M -r postfix
> }
>
> # Add postfix user to the mail group. ?This is needed for people using
cyrus,
> # linked by unix sockets (amongst other things).
> test -z "$(id postfix | awk '{print $3}' | sed -e
's/groups=//' | grep
> mail)" && {
> ? ?%whinge "Adding postfix user to mail group"
> ? ?%{_sbindir}/usermod -G mail postfix
> }
>
> # check for a new install and see if a non package installed Postfix might
> # exist. ?Attempt to avoid overwriting the source config and provide a
warning.
> if [ "$1" = 0 ]; then
> ? ?timenow=$(date +%Y%m%d-%H%M%)
> ? ?pretext="This is a new Postfix RPM installation"
> ? ?[ -f %{_sysconfdir}/postfix ] && {
> ? ? ? ?[ -n "$pretext" ] && %whinge "$pretext"
&& pretext> ? ? ? ?%whinge "Detected a possible previous non-RPM
install in
> %{_sysconfdir}/postfix."
> ? ? ? ?%whinge "- going to move it out of the way to
> %{_sysconfdir}/postfix.$timenow."
> ? ? ? ?mv %{_sysconfdir}/postfix %{_sysconfdir}/postfix.$timenow
> ? ?}
> ? ?[ -d %{initdir}/postfix ] && {
> ? ? ? ?[ -n "$pretext" ] && %whinge "$pretext"
&& pretext> ? ? ? ?%whinge "Detected a possible previous non-RPM
startup script
> %{initdir}/postfix."
> ? ? ? ?%whinge "- going to move it out of the way to
> %{initdir}/postfix.$timenow."
> ? ? ? ?mv %{initdir}/postfix %{initdir}/postfix.$timenow
> ? ?}
> fi
>
> exit 0
>
> %install
> umask 022
>
> [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" !=
"/" ] && {
> ? ?rm -rf ? ${RPM_BUILD_ROOT}
> ? ?mkdir -p ${RPM_BUILD_ROOT}
> }
>
> %{?!debug:strip -R .comment --strip-unneeded bin/* libexec/*}
>
> # rename man pages which may conflict with sendmail's
> mv man/man1/mailq.1 ? ? ?man/man1/mailq.postfix.1
> mv man/man1/newaliases.1 man/man1/newaliases.postfix.1
> mv man/man1/sendmail.1 ? man/man1/sendmail.postfix.1
> mv man/man5/aliases.5 ? ?man/man5/aliases.postfix.5
>
> # install postfix into build root
> make non-interactive-package \
> ? ? ? install_root=${RPM_BUILD_ROOT} \
> ? ? ? config_directory=%{_sysconfdir}/postfix \
> ? ? ? daemon_directory=%{_libexecdir}/postfix \
> ? ? ? command_directory=%{_sbindir} \
> ? ? ? queue_directory=%{_var}/spool/postfix \
> ? ? ? sendmail_path=%{sendmail_path} \
> ? ? ? newaliases_path=%{newaliases_path} \
> ? ? ? mailq_path=%{mailq_path} \
> ? ? ? mail_owner=postfix \
> ? ? ? setgid_group=postdrop \
> ? ? ? html_directory=%{html_dir} \
> ? ? ? manpage_directory=%{_mandir} \
> ? ? ? readme_directory=%{readme_dir} || exit 1
>
> # To be compatible with later versions of RH sendmail/postfix packages
> # make /usr/lib/sendmail.postfix point to /usr/sbin/sendmail.postfix.
> # The alternatives then point /usr/lib/sendmail to
/usr/lib/sendmail.postfix.
> # This *is* all a bit silly ...
>
> install -d -m755 $RPM_BUILD_ROOT/usr/lib
> ln -sf ../sbin/sendmail.postfix $RPM_BUILD_ROOT%{usrlib_sendmail}
>
> # RPM compresses man pages automatically. ?Edit postfix-files to avoid
> # confusing post-install.
> ed ${RPM_BUILD_ROOT}%{_libexecdir}/postfix/postfix-files <<EOF ||
exit 1
> H
> ,s/\(\/man[158]\/.*\.[158]\):/\1%{mps}:/
> w
> q
> EOF
>
> # Change alias_maps and alias_database default directory to use
> # %{_sysconfdir}/postfix
> bin/postconf -c ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix -e \
> ? ? ? ?"alias_maps = hash:%{_sysconfdir}/postfix/aliases" \
> ? ? ? ?"alias_database = hash:%{_sysconfdir}/postfix/aliases" \
> || exit 1
>
> # Change default smtpd_sasl... parameters for dovecot
> # - override postfix default behaviour IFF not using cyrus sasl.
> # - main.cf can still be adjusted manually after installation if required.
> %if %{with_dovecot}
> ?if [ "%{with_sasl}" = 0 ]; then
> ? ?bin/postconf -c ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix -e \
> ? ? ? ?"smtpd_sasl_type = dovecot" \
> ? ? ? ?"smtpd_sasl_path = private/auth" \
> ? ?|| exit 1
> ?fi
> %endif
> # Fix a typo in some of the documentation.
> perl -pi -e "s/DEF_SASL_SERVER_TYPE/DEF_SERVER_SASL_TYPE/g"
*/SASL_README*
>
> # Install Sys V init script
> mkdir -p ${RPM_BUILD_ROOT}%{initdir}
> install -c %{_sourcedir}/postfix-etc-init.d-postfix \
> ? ? ? ? ? ? ? ? ?${RPM_BUILD_ROOT}%{initdir}/postfix
>
> install -c auxiliary/rmail/rmail ${RPM_BUILD_ROOT}%{rmail_path}
> install -c auxiliary/qshape/qshape.pl ${RPM_BUILD_ROOT}/%{_sbindir}/qshape
>
> # copy new aliases files and generate a ghost aliases.db file
> cp -f %{_sourcedir}/postfix-aliases
> ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/aliases
> chmod 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/aliases
>
> touch ${RPM_BUILD_ROOT}/%{_sysconfdir}/postfix/aliases.db
>
> for i in active bounce corrupt defer deferred flush incoming private saved
\
> ? ? ? ? hold maildrop public pid; do
> ? ?mkdir -p ${RPM_BUILD_ROOT}%{_var}/spool/postfix/$i
> done
>
> # install qmqp-source, smtp-sink & smtp-source by hand
> for i in qmqp-source smtp-sink smtp-source; do
> ?install -c -m 755 bin/$i ${RPM_BUILD_ROOT}%{_sbindir}/$i
> done
>
> # install postfinger and postfix-chroot.sh scripts
> # - postfix-chroot.sh is placed in /etc/postfix to make it more visible
> install -c -m 755 %{_sourcedir}/postfinger-%{V_postfinger}
> ${RPM_BUILD_ROOT}%{_bindir}/postfinger
> install -c -m 755 %{_sourcedir}/postfix-chroot.sh
> ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/
>
> [ -d "${RPM_BUILD_ROOT}%{html_dir}" ] ? ? || mkdir -p
> ${RPM_BUILD_ROOT}%{html_dir}
> [ -d "${RPM_BUILD_ROOT}%{readme_dir}" ] ? || mkdir -p
> ${RPM_BUILD_ROOT}%{readme_dir}
> install -c -m 644 %{_sourcedir}/README-Postfix-SASL-RedHat.txt
> ${RPM_BUILD_ROOT}%{readme_dir}/
> [ -d "${RPM_BUILD_ROOT}%{examples_dir}" ] || mkdir -p
> ${RPM_BUILD_ROOT}%{examples_dir}
> cp -pr examples/* ${RPM_BUILD_ROOT}%{examples_dir}/
> # disable execution permissions to avoid rpm generating dependencies
> find ${RPM_BUILD_ROOT}%{examples_dir}/ -type f -exec chmod -x {} \;
>
> # Install odd documentation files
> for file in AAAREADME COMPATIBILITY COPYRIGHT HISTORY PORTING \
> ? ? ? ?RELEASE_NOTES RELEASE_NOTES-1.0 RELEASE_NOTES-1.1 \
> ? ? ? ?RELEASE_NOTES-2.0 RELEASE_NOTES-2.1 RELEASE_NOTES-2.2 \
> ? ? ? ?RELEASE_NOTES-2.3 RELEASE_NOTES-2.4 RELEASE_NOTES-2.5 \
> ? ? ? ?RELEASE_NOTES-2.6 RELEASE_NOTES-2.7 RELEASE_NOTES-2.8 \
> ? ? ? ?TLS_ACKNOWLEDGEMENTS TLS_CHANGES TLS_LICENSE \
> ? ? ? ?US_PATENT_6321267
> do
> ? ? ? ?install -c -m 644 $file ${RPM_BUILD_ROOT}%{docdir}/
> done
> cat <<EOF >${RPM_BUILD_ROOT}%{docdir}/SEE_ALSO
> %{_docdir}/%{name}-%{version} may contain other documentation files.
> EOF
>
> # Install the smtpd.conf file for SASL support.
> %if %{with_sasl}
> mkdir -p ${RPM_BUILD_ROOT}%{sasl_lib_dir}
> install -m 644 %SOURCE100 ${RPM_BUILD_ROOT}%{sasl_lib_dir}/smtpd.conf
> mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d
> install -m 644 %SOURCE101
${RPM_BUILD_ROOT}%{_sysconfdir}/pam.d/smtp.postfix
> mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
> install -m 644 %SOURCE102
> ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/saslauthd.postfix
> %endif
>
> # Include README.rpm explaining where the documentation can be found and
> # also pointing out how to get updated copies of my package
> cat <<EOF > ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/README.rpm
> README.rpm
> =========>
> Documentation
> -------------
>
> Postfix documentation should be available in the directory %{docdir}/.
>
> The main Postfix web site is http://www.postfix.org.
>
> Packages
> --------
>
> Newer versions of source and standard binary packages may be available from
> http://ftp.WL0.org or the mirrors listed at http://postfix.WL0.org. ?Look
> in the appropriate directory according to your distribution.
>
> Chrooting
> ---------
>
> The chroot behaviour of my packages has changed over time. Current
> packages will NOT turn on the chroot environment in Postfix. ?Older
> versions did the opposite. ?If you upgrade from an older version
> of my package the chroot behaviour will NOT be changed. (Check
> %{_sysconfdir}/postfix/master.cf for details.)
>
> I have provided a simple script postfix-chroot.sh which attempts to
> cover most situations and should enable you to disable or enable the
> chroot on your system with little effort.
>
> Package Build Options
> ---------------------
>
> This package can be built on several Linux distributions and with several
> optional features. ?%{_sysconfdir}/postfix/postfix.spec.cf contains the
> information used to build this version of the rpm. It can also
> be used to build a new rpm with the same options.
>
> Enjoy!
>
> Simon J Mudd, <sjmudd at pobox.com>
> EOF
>
> # generate postfix.spec.cf
> # - used to build a newer version of the rpm with the same parameters
> # ? as the current package.
> # - provides build instructions
> cat - %{_sourcedir}/postfix.spec.cf <<EOF | sed -e '/^#
NOTE:/d' >
> ${RPM_BUILD_ROOT}%{_sysconfdir}/postfix/postfix.spec.cf
> #
> # This file contains the following information:
> #
> # - configuration options used to build the installed postfix rpm
> # ? - generated when the binary rpm was built
> #
> # - Postfix RPM build instructions
> # ? - for upgrading the installed rpm with the same options
> # ? - for building the rpm with other options
> #
> # 1. CONFIGURATION OPTIONS OF INSTALLED BINARY RPM
> #
> # Package built on: %{build_dist_full} (%{build_dist})
>
> POSTFIX_ALT_PRIO=%{with_alt_prio}
> POSTFIX_CDB=%{with_cdb}
> POSTFIX_DB=%{requires_db}
> POSTFIX_DOVECOT=%{with_dovecot}
> POSTFIX_LDAP=%{with_ldap}
> POSTFIX_MYSQL=%{with_mysql}
> POSTFIX_MYSQL_PATHS=%{mysql_paths}
> POSTFIX_MYSQL_REDHAT=%{with_mysql_redhat}
> POSTFIX_PCRE=%{with_pcre}
> POSTFIX_PGSQL=%{with_pgsql}
> POSTFIX_SASL=%{with_sasl}
> POSTFIX_SMTPD_MULTILINE_GREETING=%{smtpd_multiline_greeting}
> POSTFIX_SPF=%{with_spf}
> POSTFIX_TLS=%{with_tls}
> POSTFIX_VDA=%{with_vda}
>
> # export values to child processes
> export POSTFIX_MYSQL POSTFIX_MYSQL_PATHS POSTFIX_MYSQL_REDHAT \\
> ?POSTFIX_LDAP POSTFIX_PCRE POSTFIX_PGSQL \\
> ?POSTFIX_SASL POSTFIX_TLS POSTFIX_VDA \\
> ?POSTFIX_SMTPD_MULTILINE_GREETING POSTFIX_DB \\
> ?POSTFIX_INCLUDE_DB POSTFIX_SPF \\
> ?POSTFIX_CDB POSTFIX_ALT_PRIO POSTFIX_DOVECOT
>
> # other options used in the build (but not explicitly changeable by
> the user) are:
> # - debug=%{?_with_debug:1}%{?!_with_debug:0}
> # - pcre_requires=%{pcre_requires},
> # - requires_zlib=%{requires_zlib},
> # - sasl_library=%{sasl_library}
> # - tlsfix=%{with_tlsfix}
> #
> # %{_sysconfdir}/postfix/makedefs.out is also produced by the build
> and may be of
> # interest if you are building Postfix by hand.
> EOF
>
> %post
> umask 022
>
> chkconfig --add postfix
>
> # Upgrade configuration as necessary
> %{_sbindir}/postfix set-permissions upgrade-configuration \
> ? ? ? ? ? setgid_group=postdrop mail_owner=postfix \
> || :
>
> %{_sbindir}/postalias %{_sysconfdir}/postfix/aliases
> %{_sbindir}/postfix check || :
>
> # Add submission to services if not found, required for rh <= 7.0
> if ! grep -q ^submission %{_sysconfdir}/services
> then
> cat <<EOF >>%{_sysconfdir}/services
> submission ? ? ?587/tcp ? ? ? ? msa ? ? # mail message submission
> submission ? ? ?587/udp ? ? ? ? msa ? ? # mail message submission
> EOF
> fi
>
> # Add smtps to services if not found
> if ! grep -q ^smtps %{_sysconfdir}/services
> then
> cat <<EOF >>%{_sysconfdir}/services
> smtps ? ? ? ? ? 465/tcp ? ? ? ? ? ? ? ? # SMTP over SSL (TLS)
> EOF
> fi
>
> # If using sasl create %{_sysconfdir}/sysconfig/saslauthd if necessary
> # - this file is provided in some (but not all) cyrus-sasl packages
> # ? - RHEL3 provides this file in cyrus-sasl >= 2.1.18-2
> %if %{with_sasl}
> [ -f %{_sysconfdir}/sysconfig/saslauthd ] || {
> ? ? ? ?grep -v "^# NOTE: "
%{_sysconfdir}/sysconfig/saslauthd.postfix >
> %{_sysconfdir}/sysconfig/saslauthd
> ? ? ? ?chmod 644 %{_sysconfdir}/sysconfig/saslauthd
> ? ? ? ?%{whinge} "creating new %{_sysconfdir}/sysconfig/saslauthd from
local
> Postfix copy"
> }
> %endif
>
> # Add comments to the /etc/dovecot.conf configuration file if it exists
> # showing how to configure with Postfix if needed. ?If postfix is mentioned
> # in the dovecot configuration file then DO NOTHING.
>
> DOVECOT_CONF=/etc/dovecot.conf
> if [ -f $DOVECOT_CONF ] && ! grep -q postfix $DOVECOT_CONF; then
> ? ? ? ?# Check if auth default is configured and add a COMMENTED SECTION
> ? ? ? ?# taken from the SASL_README file.
> ? ? ? ?if grep -q 'auth default' $DOVECOT_CONF; then
> ? ? ? ? ? ? ? ?ed $DOVECOT_CONF <<-EOF_END || exit 1
> ? ? ? ? ? ? ? ?/auth default {
> ? ? ? ? ? ? ? ?a
>
> ? ? ? ? ? ? ? ?# Postfix - suggested configuration taken from SASL_README
(2.3.2).
> ? ? ? ? ? ? ? ?# ? ?mechanisms = plain login
> ? ? ? ? ? ? ? ?# ?socket listen {
> ? ? ? ? ? ? ? ?# ? ?client {
> ? ? ? ? ? ? ? ?# ? ? ?path = /var/spool/postfix/private/auth
> ? ? ? ? ? ? ? ?# ? ? ?mode = 0660
> ? ? ? ? ? ? ? ?# ? ? ?user = postfix
> ? ? ? ? ? ? ? ?# ? ? ?group = postfix
> ? ? ? ? ? ? ? ?# ? ?}
> ? ? ? ? ? ? ? ?# ?}
>
> ? ? ? ? ? ? ? ?.
> ? ? ? ? ? ? ? ?w
> ? ? ? ? ? ? ? ?q
> ? ? ? ? ? ? ? ?EOF_END
> ? ? ? ?else
> ? ? ? ? ? ? ? ?# Add the whole section at the end.
> ? ? ? ? ? ? ? ?cat <<-EOF_END >> $DOVECOT_CONF
>
> ? ? ? ? ? ? ? ?# Postfix - suggested configuration taken from SASL_README
(2.3.2).
> ? ? ? ? ? ? ? ?#auth default {
> ? ? ? ? ? ? ? ?# ?mechanisms = plain login
> ? ? ? ? ? ? ? ?# ?passdb pam {
> ? ? ? ? ? ? ? ?# ?}
> ? ? ? ? ? ? ? ?# ?userdb passwd {
> ? ? ? ? ? ? ? ?# ?}
> ? ? ? ? ? ? ? ?# ?socket listen {
> ? ? ? ? ? ? ? ?# ? ?client {
> ? ? ? ? ? ? ? ?# ? ? ?path = /var/spool/postfix/private/auth
> ? ? ? ? ? ? ? ?# ? ? ?mode = 0660
> ? ? ? ? ? ? ? ?# ? ? ?user = postfix
> ? ? ? ? ? ? ? ?# ? ? ?group = postfix
> ? ? ? ? ? ? ? ?# ? ?}
> ? ? ? ? ? ? ? ?# ?}
> ? ? ? ? ? ? ? ?#}
>
> ? ? ? ? ? ? ? ?EOF_END
> ? ? ? ?fi
> fi
>
> # Apply the alternatives scripts ONLY if installing (not upgrading) to
> # ensure a link exists from %{_sbindir}/sendmail to
> # %{sendmail_path} (and other files).
> #
> # If performing an upgrade this MUST be done in the trigger scripts.
> # (old postfix packages, pre-alternatives have a /usr/sbin/sendmail and
this
> # gets removed _AFTER_ the %post stage when the old package is removed)
>
> [ "$1" = 1 ] || exit 0
>
> # See changelog for explanation of mta-sendmailman entry.
> %{_sbindir}/alternatives --install %{_sbindir}/sendmail mta
> %{sendmail_path} %{with_alt_prio} \
> ? ?--slave %{_bindir}/mailq mta-mailq %{mailq_path} \
> ? ?--slave %{_bindir}/newaliases mta-newaliases %{newaliases_path} \
> ? ?--slave %{_bindir}/rmail mta-rmail %{rmail_path} \
> ? ?--slave /usr/lib/sendmail mta-sendmail %{usrlib_sendmail} \
> ? ?--slave %{_mandir}/man8/sendmail.8%{mps} ? mta-sendmailman
> %{_mandir}/man1/sendmail.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man1/mailq.1%{mps} ? ? ?mta-mailqman
> %{_mandir}/man1/mailq.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man1/newaliases.1%{mps} mta-newaliasesman
> %{_mandir}/man1/newaliases.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man5/aliases.5%{mps} ? ?mta-aliasesman
> %{_mandir}/man5/aliases.postfix.5%{mps} \
> ? ?--initscript postfix
>
> exit 0
>
> %triggerpostun -- sendmail
>
> # If removing sendmail and not using alternatives: replace with
> postfix equivalents
> %whinge "%{V_postfix}-%{rel} triggerpostun -- sendmail: final number
> of sendmail packages=$2"
> [ $2 = 0 ] || exit 0
>
> # See changelog for explanation of mta-sendmailman entry.
> %{_sbindir}/alternatives --install %{_sbindir}/sendmail mta
> %{sendmail_path} %{with_alt_prio} \
> ? ?--slave %{_bindir}/mailq mta-mailq %{mailq_path} \
> ? ?--slave %{_bindir}/newaliases mta-newaliases %{newaliases_path} \
> ? ?--slave %{_bindir}/rmail mta-rmail %{rmail_path} \
> ? ?--slave /usr/lib/sendmail mta-sendmail %{usrlib_sendmail} \
> ? ?--slave %{_mandir}/man8/sendmail.8%{mps} ? mta-sendmailman
> %{_mandir}/man1/sendmail.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man1/mailq.1%{mps} ? ? ?mta-mailqman
> %{_mandir}/man1/mailq.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man1/newaliases.1%{mps} mta-newaliasesman
> %{_mandir}/man1/newaliases.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man5/aliases.5%{mps} ? ?mta-aliasesman
> %{_mandir}/man5/aliases.postfix.5%{mps} \
> ? ?--initscript postfix
> exit 0 ?# ensure the trigger exit status is 0
>
> %triggerpostun -- postfix
>
> # If upgrading postfix some versions are pre-alternatives and use
> # /usr/sbin/sendmail. ?After uninstalling the old package this file will be
> # missing and we need to link to the new postfix sendmail binary.
> %whinge "%{V_postfix}-%{rel} triggerpostun -- postfix: final number of
> Postfix packages=$2"
> [ $2 -gt 0 ] || exit 0
>
> # See changelog for explanation of mta-sendmailman entry.
> %{_sbindir}/alternatives --install %{_sbindir}/sendmail mta
> %{sendmail_path} %{with_alt_prio} \
> ? ?--slave %{_bindir}/mailq mta-mailq %{mailq_path} \
> ? ?--slave %{_bindir}/newaliases mta-newaliases %{newaliases_path} \
> ? ?--slave %{_bindir}/rmail mta-rmail %{rmail_path} \
> ? ?--slave /usr/lib/sendmail mta-sendmail %{usrlib_sendmail} \
> ? ?--slave %{_mandir}/man8/sendmail.8%{mps} ? mta-sendmailman
> %{_mandir}/man1/sendmail.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man1/mailq.1%{mps} ? ? ?mta-mailqman
> %{_mandir}/man1/mailq.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man1/newaliases.1%{mps} mta-newaliasesman
> %{_mandir}/man1/newaliases.postfix.1%{mps} \
> ? ?--slave %{_mandir}/man5/aliases.5%{mps} ? ?mta-aliasesman
> %{_mandir}/man5/aliases.postfix.5%{mps} \
> ? ?--initscript postfix
> exit 0 ?# ensure the trigger exit status is 0
>
> %preun
> umask 022
>
> # remove the directory and depth levels of subdirectories
>
> queue_hash_depth_remove () {
> ? ?local dir=$1
> ? ?local depth=$2
> ? ?local new_depth
> ? ?local a
> ? ?[ -d "$dir" ] && {
> ? ? ? ?if [ "$depth" -gt 0 ]; then
> ? ? ? ? ? ?new_depth=$(($depth - 1))
> ? ? ? ? ? ?for a in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
> ? ? ? ? ? ? ? ?test -d $dir/$a && queue_hash_depth_remove $dir/$a
$new_depth
> ? ? ? ? ? ?done
> ? ? ? ?fi
> ? ? ? ?rm -f $dir/*
> ? ? ? ?rmdir $dir || %whinge "WARNING: preun - unable to remove
> directory %{_var}/spool/postfix/$dir"
> ? ?}
> }
>
> # remove the rest of the queue directory structure
> queue_directory_remove () {
> ? ?# remove the hashed directories
> ? ?depth=$(postconf -h hash_queue_depth)
> ? ?for dir in $(postconf -h hash_queue_names | sed -e 's/,/\n/g; s/
//g'); do
> ? ? ? ?queue_hash_depth_remove $dir $depth
> ? ?done
>
> ? ?# now remove the other directories
> ? ?for dir in corrupt hold maildrop pid private public saved; do
> ? ? ? ?queue_hash_depth_remove $dir 0
> ? ?done
> }
>
> # No more postfix packages left so prepare to finish package removal.
> # _In theory_ there is no chroot environment now, so there is no need to
> # clean it out.
> # However it may be prudent later to add back a call to
> # /etc/postfix/postfix-chroot.sh disable
> # just to make sure, but won't do this yet. (If you think I should let
> # me know).
> if [ "$1" = 0 ]; then
> ? ?service postfix stop >/dev/null 2>&1
> ? ?chkconfig --del postfix
>
> ? ?%{_sbindir}/alternatives --remove mta %{sendmail_path}
>
> ? ?# userdel also deletes the user's group
> ? ?%{_sbindir}/userdel postfix ? || %whinge "WARNING: failed to
> remove user postfix"
> ? ?%{_sbindir}/groupdel postdrop || %whinge "WARNING: failed to
> remove group postdrop"
>
> ? ?cd %{_var}/spool/postfix && queue_directory_remove
> fi
>
> exit 0
>
> %postun
> umask 022
> if [ "$1" -ge 1 ]; then
> ? ?service postfix condrestart || :
> ? ?# don't use readlink as this is not available on rh73
> ? ?mta=`[ -L /etc/alternatives/mta ] && ls -la
/etc/alternatives/mta
> | awk '{ print $11 }'`
> ? ?if [ "$mta" = "%{sendmail_path}" ]; then
> ? ? ? ?%{_sbindir}/alternatives --set mta %{sendmail_path}
> ? ?fi
> fi
> exit 0
>
> %clean
> umask 022
> [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" !=
"/" ] && {
> ? ?rm -rf ${RPM_BUILD_ROOT}
> } || :
>
> %files
> %defattr(-, root, root)
>
> %if %{with_sasl}
> %config(noreplace) %{sasl_lib_dir}/smtpd.conf
> %config(noreplace) %{_sysconfdir}/pam.d/smtp.postfix
> %config(noreplace) %{_sysconfdir}/sysconfig/saslauthd.postfix
> %endif
>
> %verify(not md5 size mtime) %config %dir %{_sysconfdir}/postfix
> %attr(0644, root, root) ? ? ? ? %{_sysconfdir}/postfix/LICENSE
> %attr(0644, root, root) ? ? ? ? %{_sysconfdir}/postfix/TLS_LICENSE
> %attr(0444, root, root) %config %{_sysconfdir}/postfix/makedefs.out
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/main.cf
> %attr(0644, root, root)
> %{_sysconfdir}/postfix/main.cf.default
> %attr(0644, root, root)
> %{_sysconfdir}/postfix/bounce.cf.default
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/master.cf
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/access
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/aliases
> %attr(0644, root, root) %verify(not md5 size mtime) %ghost
> %{_sysconfdir}/postfix/aliases.db
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/canonical
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/generic
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/header_checks
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/relocated
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/transport
> %attr(0644, root, root) %verify(not md5 size mtime) %config(noreplace)
> %{_sysconfdir}/postfix/virtual
>
> %attr(0755, root, root) %config %{_libexecdir}/postfix/postfix-script
> %attr(0755, root, root) ? ? ? ? %{_libexecdir}/postfix/postfix-wrapper
> %attr(0755, root, root) ? ? ? ? %{_libexecdir}/postfix/postmulti-script
> %attr(0755, root, root) %config %{_libexecdir}/postfix/post-install
> %attr(0644, root, root) ? ? ? ? %{_libexecdir}/postfix/postfix-files
> %attr(0644, root, root) ? ? ? ? %{_libexecdir}/postfix/main.cf
> %attr(0644, root, root) ? ? ? ? %{_libexecdir}/postfix/master.cf
> %attr(0755, root, root) ? ? ? ? %{_libexecdir}/postfix/dnsblog
> %attr(0755, root, root) ? ? ? ? %{_libexecdir}/postfix/postscreen
> %attr(0755, root, root) ? ? ? ? %{_libexecdir}/postfix/tlsproxy
>
> %attr(0644, root, root) %{_sysconfdir}/postfix/README.rpm
> %attr(0644, root, root) %{_sysconfdir}/postfix/postfix.spec.cf
>
> %attr(0755, root, root) %{_sysconfdir}/postfix/postfix-chroot.sh
>
> %attr(0755, root, root) %config %{initdir}/postfix
>
> %dir ? ? ? ? ? ? ? ? ? ? ?%verify(not md5 size mtime) %{_var}/spool/postfix
>
> # For correct directory permissions check postfix-install script
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/active
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/bounce
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/corrupt
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/defer
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/deferred
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/flush
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/hold
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/incoming
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/private
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/spool/postfix/saved
> %dir %attr(0730, postfix, postdrop) %verify(not md5 size mtime)
> %{_var}/spool/postfix/maildrop
> %dir %attr(0710, postfix, postdrop) %verify(not md5 size mtime)
> %{_var}/spool/postfix/public
> %dir %attr(0755, root, root) ? ? ? ?%verify(not md5 size mtime)
> %{_var}/spool/postfix/pid
> %dir %attr(0700, postfix, root) ? ? %verify(not md5 size mtime)
> %{_var}/lib/postfix
>
> %doc %{docdir}/AAAREADME
> %doc %{docdir}/COMPATIBILITY
> %doc %{docdir}/COPYRIGHT
> %doc %{docdir}/HISTORY
> %doc %{docdir}/PORTING
> %doc %{docdir}/RELEASE_NOTES
> %doc %{docdir}/RELEASE_NOTES-1.0
> %doc %{docdir}/RELEASE_NOTES-1.1
> %doc %{docdir}/RELEASE_NOTES-2.0
> %doc %{docdir}/RELEASE_NOTES-2.1
> %doc %{docdir}/RELEASE_NOTES-2.2
> %doc %{docdir}/RELEASE_NOTES-2.3
> %doc %{docdir}/RELEASE_NOTES-2.4
> %doc %{docdir}/RELEASE_NOTES-2.5
> %doc %{docdir}/RELEASE_NOTES-2.6
> %doc %{docdir}/RELEASE_NOTES-2.7
> %doc %{docdir}/RELEASE_NOTES-2.8
> %doc %{docdir}/SEE_ALSO
> %doc %{docdir}/TLS_ACKNOWLEDGEMENTS
> %doc %{docdir}/TLS_CHANGES
> %doc %{docdir}/TLS_LICENSE
> %doc %{docdir}/US_PATENT_6321267
>
> %doc %dir %{readme_dir}
> %doc %{readme_dir}/*
> %doc %dir %{html_dir}
> %doc %{html_dir}/*
> %doc %dir %{examples_dir}
> %doc %dir %{examples_dir}/chroot-setup
> %dir %dir %{examples_dir}/qmail-local
> %dir %dir %{examples_dir}/smtpd-policy
> %doc %{examples_dir}/chroot-setup/*
> %doc %{examples_dir}/qmail-local/*
> %doc %{examples_dir}/smtpd-policy/*
>
> %dir %attr(0755, root, root) %verify(not md5 size mtime)
%{_libexecdir}/postfix
> %{_libexecdir}/postfix/anvil
> %{_libexecdir}/postfix/bounce
> %{_libexecdir}/postfix/cleanup
> %{_libexecdir}/postfix/discard
> %{_libexecdir}/postfix/error
> %{_libexecdir}/postfix/flush
> %{_libexecdir}/postfix/lmtp
> %{_libexecdir}/postfix/local
> %{_libexecdir}/postfix/master
> %{_libexecdir}/postfix/nqmgr
> %{_libexecdir}/postfix/oqmgr
> %{_libexecdir}/postfix/pickup
> %{_libexecdir}/postfix/pipe
> %{_libexecdir}/postfix/proxymap
> %{_libexecdir}/postfix/qmgr
> %{_libexecdir}/postfix/qmqpd
> # including as installed by Wietse even with -DNO_TLS ?
> %{_libexecdir}/postfix/scache
> %{_libexecdir}/postfix/showq
> %{_libexecdir}/postfix/smtp
> %{_libexecdir}/postfix/smtpd
> %{_libexecdir}/postfix/spawn
> # including as installed by Wietse even with -DNO_TLS ?
> %{_libexecdir}/postfix/tlsmgr
> %{_libexecdir}/postfix/trivial-rewrite
> %{_libexecdir}/postfix/verify
> %{_libexecdir}/postfix/virtual
>
> %{_sbindir}/postalias
> %{_sbindir}/postcat
> %{_sbindir}/postconf
> %attr(2755,root,postdrop) %{_sbindir}/postdrop
> %attr(2755,root,postdrop) %{_sbindir}/postqueue
> %{_sbindir}/postfix
> %{_sbindir}/postkick
> %{_sbindir}/postlock
> %{_sbindir}/postlog
> %{_sbindir}/postmap
> %{_sbindir}/postmulti
> %{_sbindir}/postsuper
>
> %{_sbindir}/smtp-sink
> %{_sbindir}/smtp-source
> %{_sbindir}/qmqp-source
>
> %{sendmail_path}
> %{mailq_path}
> %{newaliases_path}
> %{usrlib_sendmail}
> %attr(0755, root, root) %{rmail_path}
> %attr(0755, root, root) %{_bindir}/postfinger
> %attr(0755, root, root) %{_sbindir}/qshape
>
> %{_mandir}/*/*
>
>
##############################################################################
> # List of changes made to this package.
> #
> # Although old entries from the changelog have been removed most of them
> # are available from my CVS repository of changes made to this file.
> #
>
> %changelog
>
> * Sun Feb 19 2012 Simon J Mudd <sjmudd at pobox.com> 2.9.1-1
> ?- minor tweaks and upgrade to 2.9.1
>
> * Sat Feb 11 2012 Simon J Mudd <sjmudd at pobox.com> 2.9.0-1
> ?- initial work on postfix-2.9.0
> ?- pending issues on upgrade from 2.8.8
> ? ? ?# chown: cannot access
> `/usr/share/doc/postfix-2.8.8-documentation/readme/MEMCACHE_README':
> No such file or directory
>
> * Sat Feb 11 2012 Simon J Mudd <sjmudd at pobox.com> 2.8.8-1
> ?- upgrade to postfix-2.8.8-1
> ?- previous info removed from here and can be seen in the POSTFIX_2_8
branch
>
> =========>
> Thanks in advance,
> Tim
>
> --
> GPG me!!
>
> gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
--
GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B