570 lines
21 KiB
RPMSpec
570 lines
21 KiB
RPMSpec
#
|
|
# spec file for package postfix (Version 2.6.1)
|
|
#
|
|
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
# norootforbuild
|
|
|
|
%define usetls 1
|
|
|
|
Name: postfix
|
|
Summary: A fast, secure, and flexible mailer
|
|
Version: 2.6.1
|
|
Release: 1
|
|
License: IBM Public License ..
|
|
Group: Productivity/Networking/Email/Servers
|
|
Url: http://www.postfix.org/
|
|
AutoReqProv: on
|
|
Source: %{name}-%{version}.tar.bz2
|
|
Source1: %{name}-SuSE.tar.gz
|
|
Source2: %{name}-mysql.tar.bz2
|
|
Source10: rpmlintrc
|
|
Patch: dynamic_maps.patch
|
|
Patch1: dynamic_maps_pie.patch
|
|
Patch2: pointer_to_literals.patch
|
|
Patch3: ipv6_disabled.patch
|
|
Patch10: %{name}-2.2.9-main.cf.patch
|
|
Patch11: %{name}-%{version}-vda-ng.patch
|
|
Patch12: %{name}-%{version}-vda-ng-64bit.patch
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
PreReq: %insserv_prereq %fillup_prereq
|
|
PreReq: /usr/bin/getent
|
|
PreReq: /usr/sbin/useradd /usr/sbin/groupadd
|
|
PreReq: /bin/sed /bin/awk /bin/grep
|
|
PreReq: textutils sh-utils fileutils pcre openldap2-client netcfg
|
|
BuildRequires: db-devel
|
|
BuildRequires: mysql-devel
|
|
BuildRequires: openldap2-devel pcre-devel postgresql-devel
|
|
# require pwdutils to make postinstall script check work
|
|
BuildRequires: pwdutils
|
|
%if 0%{?suse_version} >= 1100
|
|
BuildRequires: fdupes
|
|
%endif
|
|
#
|
|
Conflicts: sendmail exim
|
|
Provides: smtp_daemon
|
|
#
|
|
# Some defines
|
|
#
|
|
%define pf_docdir %{_docdir}/%{name}-doc
|
|
%define postfixfiles %{name}.filelist
|
|
%define pf_config_directory /etc/%{name}
|
|
%define pf_daemon_directory /usr/lib/%{name}
|
|
%define pf_command_directory /usr/sbin
|
|
%define pf_queue_directory var/spool/%{name}
|
|
%define pf_sendmail_path /usr/sbin/sendmail
|
|
%define pf_newaliases_path /usr/bin/newaliases
|
|
%define pf_mailq_path /usr/bin/mailq
|
|
%define pf_setgid_group maildrop
|
|
%define pf_readme_directory %{_docdir}/%{name}-doc/README_FILES
|
|
%define pf_html_directory %{_docdir}/%{name}-doc/html
|
|
%define pf_sample_directory %{_docdir}/%{name}-doc/samples
|
|
%define pf_data_directory /var/lib/%{name}
|
|
%define pf_uid 51
|
|
%define pf_gid 51
|
|
%define maildrop_gid 59
|
|
%define conf_backup_dir /var/adm/backup/%{name}
|
|
%define omc_pdir /usr/share/omc/
|
|
%define omc_dir /usr/share/omc/svcinfo.d/
|
|
#
|
|
%define vmusr vmail
|
|
%define vmgid 303
|
|
%define vmid 303
|
|
%define vmdir /srv/maildirs
|
|
#
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%description
|
|
Postfix aims to be an alternative to the widely-used sendmail program.
|
|
|
|
Authors:
|
|
--------
|
|
Wietse Venema <wietse@porcupine.org>
|
|
|
|
|
|
%package devel
|
|
Summary: Development headers for the postfix package
|
|
License: IBM Public License ..
|
|
Group: Development/Libraries/C and C++
|
|
AutoReqProv: on
|
|
PreReq: %{name} = %{version}
|
|
|
|
%description devel
|
|
Postfix aims to be an alternative to the widely-used sendmail program.
|
|
|
|
Authors:
|
|
--------
|
|
Wietse Venema <wietse@porcupine.org>
|
|
|
|
|
|
%package doc
|
|
Summary: Documentations for the postfix package
|
|
License: IBM Public License ..
|
|
Group: Productivity/Networking/Email/Servers
|
|
|
|
%description doc
|
|
Postfix aims to be an alternative to the widely-used sendmail program.
|
|
This package contains the documentation for %{name}
|
|
|
|
Authors:
|
|
--------
|
|
Wietse Venema <wietse@porcupine.org>
|
|
|
|
|
|
%package mysql
|
|
Summary: Postfix plugin to support MySQL maps
|
|
License: IBM Public License ..
|
|
Group: Productivity/Networking/Email/Servers
|
|
AutoReqProv: on
|
|
PreReq: %{name} = %{version}
|
|
|
|
%description mysql
|
|
Postfix plugin to support MySQL maps. This library will be loaded by
|
|
starting %{name} if you'll access a postmap which is stored in mysql.
|
|
|
|
Authors:
|
|
--------
|
|
Wietse Venema <wietse@porcupine.org>
|
|
|
|
|
|
%package postgresql
|
|
Summary: Postfix plugin to support PostgreSQL maps
|
|
License: IBM Public License ..
|
|
Group: Productivity/Networking/Email/Servers
|
|
AutoReqProv: on
|
|
PreReq: %{name} = %{version}
|
|
|
|
%description postgresql
|
|
Postfix plugin to support PostgreSQL maps. This library will be loaded
|
|
by starting %{name} if you'll access a postmap which is stored in
|
|
PostgreSQL.
|
|
|
|
Authors:
|
|
--------
|
|
Wietse Venema <wietse@porcupine.org>
|
|
|
|
|
|
%prep
|
|
%setup -n %{name}-%{version} -a 1 -a 2
|
|
%patch -p1
|
|
%patch1
|
|
%patch2 -p1
|
|
%patch3 -p1
|
|
%patch10 -p1
|
|
%patch11 -p1
|
|
%ifarch x86_64
|
|
%patch12 -p1
|
|
%endif
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%build
|
|
export CCARGS="-DHAS_LDAP -DHAS_PCRE -DUSE_SASL_AUTH -I/usr/include/sasl"
|
|
export CCARGS="$CCARGS -DMAX_DYNAMIC_MAPS"
|
|
export CCARGS="$CCARGS -DHAS_MYSQL -I/usr/include/mysql"
|
|
export CCARGS="$CCARGS -DHAS_PGSQL -I/usr/include/pgsql"
|
|
export CCARGS="$CCARGS -DUSE_CYRUS_SASL"
|
|
export AUXLIBS="-lldap -llber -lpcre"
|
|
export AUXLIBS="$AUXLIBS -lsasl2"
|
|
%if %{usetls}
|
|
export AUXLIBS="$AUXLIBS -lssl -lcrypto"
|
|
%endif
|
|
%if %{usetls}
|
|
export CCARGS="$CCARGS -DUSE_TLS"
|
|
%endif
|
|
export CCARGS="$CCARGS $RPM_OPT_FLAGS -Wno-comments"
|
|
export PIE=-pie
|
|
make makefiles DEBUG=""
|
|
cd lib
|
|
for i in dns global master tls util milter; do
|
|
ln -sf lib${i}.a lib%{name}-${i}.so.1.0.1;
|
|
done
|
|
cd -
|
|
make LD_LIBRARY_PATH=$(pwd)/lib:${LD_LIBRARY_PATH}
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%install
|
|
/usr/sbin/groupadd -g %{pf_gid} -o -r %{name} 2> /dev/null || :
|
|
/usr/sbin/groupadd -g %{maildrop_gid} -o -r maildrop 2> /dev/null || :
|
|
/usr/sbin/useradd -r -o -g %{name} -u %{pf_uid} -s /bin/false -c "Postfix Daemon" -d /%{pf_queue_directory} %{name} 2> /dev/null || :
|
|
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
|
|
install lib/*.1 $RPM_BUILD_ROOT/%{_libdir}
|
|
for i in $RPM_BUILD_ROOT/%{_libdir}/*.1; do
|
|
ln -sf ${i##*/} ${i%.*.*}
|
|
done
|
|
cd lib
|
|
for i in libpostfix-*; do
|
|
ln -sf $i $RPM_BUILD_ROOT/%{_libdir}/${i%so.*}so
|
|
done
|
|
cd -
|
|
ln -sf $(pwd)/lib/dict_* libexec/
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RPM_BUILD_ROOT/%{_libdir}
|
|
sh postfix-install -non-interactive \
|
|
install_root=%{buildroot} \
|
|
config_directory=%{pf_config_directory} \
|
|
daemon_directory=%{pf_daemon_directory} \
|
|
command_directory=%{pf_command_directory} \
|
|
queue_directory=/%{pf_queue_directory} \
|
|
sendmail_path=%{pf_sendmail_path} \
|
|
newaliases_path=%{pf_newaliases_path} \
|
|
mailq_path=%{pf_mailq_path} \
|
|
manpage_directory=%{_mandir} \
|
|
setgid_group=%{pf_setgid_group} \
|
|
readme_directory=%{pf_readme_directory} \
|
|
data_directory=%{pf_data_directory}
|
|
ln -sf ../sbin/sendmail $RPM_BUILD_ROOT/usr/lib/sendmail
|
|
for i in qmqp-source smtp-sink smtp-source; do
|
|
install -m 755 bin/$i $RPM_BUILD_ROOT/usr/sbin/$i
|
|
done
|
|
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
|
mkdir -p $RPM_BUILD_ROOT/sbin/conf.d
|
|
mkdir -p $RPM_BUILD_ROOT/etc/permissions.d
|
|
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/sasl2
|
|
mkdir -p $RPM_BUILD_ROOT/usr/sbin
|
|
mkdir -p $RPM_BUILD_ROOT/%{conf_backup_dir}
|
|
mkdir -p $RPM_BUILD_ROOT/%{pf_sample_directory}
|
|
mkdir -p $RPM_BUILD_ROOT/usr/include/%{name}
|
|
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
|
|
install -m 644 %{name}-SuSE/smtp $RPM_BUILD_ROOT/etc/pam.d/smtp
|
|
#mkdir samples
|
|
install -m 755 %{name}-SuSE/rc.%{name} $RPM_BUILD_ROOT/etc/init.d/%{name}
|
|
ln -sf ../etc/init.d/%{name} $RPM_BUILD_ROOT/sbin/rc%{name}
|
|
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
|
|
rm -f $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}
|
|
sed -e 's;@lib@;%{_lib};g' %{name}-SuSE/sysconfig.%{name} > $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}
|
|
install -m 644 %{name}-SuSE/sysconfig.mail-%{name} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.mail-%{name}
|
|
rm -f $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name}
|
|
sed -e 's;@lib@;%{_lib};g' \
|
|
-e 's;@conf_backup_dir@;%{conf_backup_dir};' \
|
|
-e 's;@daemon_directory@;%{pf_daemon_directory};' \
|
|
-e 's;@readme_directory@;%{pf_readme_directory};' \
|
|
-e 's;@html_directory@;%{pf_html_directory};' \
|
|
-e 's;@sendmail_path@;%{pf_sendmail_path};' \
|
|
-e 's;@setgid_group@;%{pf_setgid_group};' \
|
|
-e 's;@manpage_directory@;%{_mandir};' \
|
|
-e 's;@newaliases_path@;%{pf_newaliases_path};' \
|
|
-e 's;@sample_directory@;%{pf_sample_directory};' \
|
|
-e 's;@mailq_path@;%{pf_mailq_path};' %{name}-SuSE/SuSEconfig.%{name} \
|
|
> $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name}
|
|
chmod 755 $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name}
|
|
install -m 644 %{name}-SuSE/master.cf $RPM_BUILD_ROOT/etc/%{name}/master.cf
|
|
install -m 644 %{name}-SuSE/dynamicmaps.cf $RPM_BUILD_ROOT/etc/%{name}/dynamicmaps.cf
|
|
install -m 644 %{name}-SuSE/helo_access $RPM_BUILD_ROOT/etc/postfix/helo_access
|
|
install -m 644 %{name}-SuSE/permissions $RPM_BUILD_ROOT/etc/permissions.d/%{name}
|
|
install -m 644 %{name}-SuSE/sender_canonical $RPM_BUILD_ROOT/etc/%{name}/sender_canonical
|
|
install -m 644 %{name}-SuSE/relay $RPM_BUILD_ROOT/etc/postfix/relay
|
|
install -m 644 %{name}-SuSE/relay_ccerts $RPM_BUILD_ROOT/etc/%{name}/relay_ccerts
|
|
install -m 600 %{name}-SuSE/sasl_passwd $RPM_BUILD_ROOT/etc/%{name}/sasl_passwd
|
|
mkdir -p $RPM_BUILD_ROOT/etc/sasl2
|
|
install -m 600 %{name}-SuSE/smtpd.conf $RPM_BUILD_ROOT/etc/sasl2/smtpd.conf
|
|
install -m 644 %{name}-SuSE/openssl_%{name}.conf.in $RPM_BUILD_ROOT/etc/%{name}/openssl_%{name}.conf.in
|
|
install -m 755 %{name}-SuSE/mk%{name}cert $RPM_BUILD_ROOT/usr/sbin/mk%{name}cert
|
|
rm -rf $RPM_BUILD_ROOT/%{pf_queue_directory}
|
|
install -m 644 %{name}-SuSE/master.cf $RPM_BUILD_ROOT/%{conf_backup_dir}/master.cf
|
|
mkdir -p $RPM_BUILD_ROOT/%{omc_dir}
|
|
install -m 644 %{name}-SuSE/%{name}.xml $RPM_BUILD_ROOT/%{omc_dir}
|
|
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/
|
|
install -m 644 %{name}-SuSE/%{name}-fw $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/%{name}
|
|
{
|
|
cat<<EOF
|
|
#
|
|
# -----------------------------------------------------------------------
|
|
# NOTE: Many parameters have already been added to the end of this file
|
|
# by SuSEconfig.postfix. So take care that you don't uncomment
|
|
# and set a parameter without checking whether it has been added
|
|
# to the end of this file.
|
|
# -----------------------------------------------------------------------
|
|
#
|
|
EOF
|
|
cat conf/main.cf
|
|
} > $RPM_BUILD_ROOT/etc/%{name}/main.cf
|
|
$RPM_BUILD_ROOT/usr/sbin/postconf -c $RPM_BUILD_ROOT/etc/%{name} \
|
|
-e "manpage_directory = %{_mandir}" \
|
|
"setgid_group = %{pf_setgid_group}" \
|
|
"mailq_path = %{pf_mailq_path}" \
|
|
"newaliases_path = %{pf_newaliases_path}" \
|
|
"sendmail_path = %{pf_sendmail_path}" \
|
|
"readme_directory = %{pf_readme_directory}" \
|
|
"html_directory = %{pf_html_directory}" \
|
|
"sample_directory = %{pf_sample_directory}" \
|
|
"daemon_directory = %{pf_daemon_directory}" \
|
|
"biff = no" \
|
|
"inet_protocols = all"
|
|
install -m 644 $RPM_BUILD_ROOT/etc/%{name}/main.cf $RPM_BUILD_ROOT/%{conf_backup_dir}/main.cf
|
|
# -----------------------------------------------------------------------
|
|
# preparing /etc/postfix/postfix-files to be able to use postfix
|
|
# own upgrade script. Unfortunately it looks in postfix-files and
|
|
# expects aliases file at /etc/postfix/aliases and it expects to have
|
|
# unzipped manpages
|
|
# also remove the both sql dictionary libs as they will not be installed
|
|
# per default
|
|
# -----------------------------------------------------------------------
|
|
rm -f $RPM_BUILD_ROOT/etc/%{name}/aliases
|
|
rm -f $RPM_BUILD_ROOT/etc/%{name}/%{name}-files
|
|
sed 's;^$config_directory/aliases\(.*\);/etc/aliases\1;' conf/%{name}-files \
|
|
| grep -v '^$manpage_directory' | grep -Ev 'dict_(mysql|pgsql)' > $RPM_BUILD_ROOT/etc/%{name}/%{name}-files
|
|
rm -f %{postfixfiles}
|
|
test -f conf/%{name}-files || {
|
|
echo "conf/%{name}-files does not exist!"
|
|
exit 1
|
|
}
|
|
echo "%defattr(-,root,root)" >> %{postfixfiles}
|
|
exec <conf/%{name}-files
|
|
while IFS=: read path type owner group mode flags junk; do
|
|
owner=${owner/\$mail_owner/postfix}
|
|
group=${group/\$setgid_group/%{pf_setgid_group}}
|
|
case $path in
|
|
\$queue_directory*)
|
|
path=${path/\$queue_directory/\/var\/spool\/postfix}
|
|
group=${group/-/root}
|
|
echo "%dir %attr($mode,$owner,$group) $path/" >> %{postfixfiles}
|
|
mkdir -m $mode -p $RPM_BUILD_ROOT/$path
|
|
printf '%%-38s %%-18s %%04d\n' $path "${owner}.${group}" $mode >> $RPM_BUILD_ROOT/etc/permissions.d/%{name}
|
|
;;
|
|
\$command_directory/*)
|
|
path=${path/\$command_directory/\/usr\/sbin}
|
|
group=${group/-/root}
|
|
echo "%attr($mode,$owner,$group) $path" >> %{postfixfiles}
|
|
printf '%%-38s %%-18s %%04d\n' $path "${owner}.${group}" $mode >> $RPM_BUILD_ROOT/etc/permissions.d/%{name}
|
|
;;
|
|
*) continue;;
|
|
esac
|
|
done
|
|
# postfix-mysql
|
|
install -m 644 %{name}-mysql/main.cf-mysql $RPM_BUILD_ROOT/etc/%{name}/main.cf-mysql
|
|
install -m 640 %{name}-mysql/*_maps.cf $RPM_BUILD_ROOT/etc/%{name}/
|
|
# create paranoid permissions file
|
|
printf '%%-38s %%-18s %%s\n' /usr/sbin/postdrop "root.%{pf_setgid_group}" "0755" >> $RPM_BUILD_ROOT/etc/permissions.d/%{name}.paranoid
|
|
printf '%%-38s %%-18s %%s\n' /usr/sbin/postqueue "root.%{pf_setgid_group}" "0755" >> $RPM_BUILD_ROOT/etc/permissions.d/%{name}.paranoid
|
|
install -m 644 include/*.h $RPM_BUILD_ROOT/usr/include/%{name}/
|
|
# some rpmlint stuff
|
|
# remove unneeded examples/chroot-setup
|
|
for example in AIX42 BSDI* F* HPUX* IRIX* NETBSD1 NEXTSTEP3 OPENSTEP4 OSF1 Solaris*; do
|
|
%{__rm} examples/chroot-setup/${example}
|
|
done
|
|
# files-duplicate /usr/share/doc/packages/postfix-doc/html/
|
|
# so we copy all docs to a postfix-doc to do fdupes :)
|
|
%{__install} -d $RPM_BUILD_ROOT%{pf_docdir}/html
|
|
for doc in AAAREADME COMPATIBILITY COPYRIGHT HISTORY INSTALL IPv6-ChangeLog LICENSE PORTING RELEASE_NOTES* US_PATENT_6321267 TLS_LICENSE README_FILES auxiliary examples html %{name}-SuSE/README.SuSE %{name}-SuSE/SPAMASSASSIN+POSTFIX.SuSE; do
|
|
%{__cp} -rv ${doc} $RPM_BUILD_ROOT%{pf_docdir}/
|
|
done
|
|
%if 0%{?suse_version} >= 1100
|
|
%fdupes $RPM_BUILD_ROOT%{pf_docdir}
|
|
# files-duplicate /usr/share/man/man?
|
|
%fdupes $RPM_BUILD_ROOT%{_mandir}
|
|
%endif
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%pre
|
|
VERSIONTEST=$(test -x usr/sbin/postconf && usr/sbin/postconf proxy_read_maps 2>/dev/null)
|
|
if [ -z "$VERSIONTEST" -a -f %{pf_queue_directory}/pid/master.pid ]; then
|
|
if checkproc -p %{pf_queue_directory}/pid/master.pid usr/lib/%{name}/master; then
|
|
echo "%{name} is still running. You have to stop %{name} in order to"
|
|
echo "install a newer version."
|
|
exit 1
|
|
fi
|
|
fi
|
|
/usr/sbin/groupadd -g %{pf_gid} -o -r %{name} 2> /dev/null || :
|
|
/usr/sbin/groupadd -g %{maildrop_gid} -o -r maildrop 2> /dev/null || :
|
|
/usr/sbin/useradd -r -o -g %{name} -u %{pf_uid} -s /bin/false -c "Postfix Daemon" -d /%{pf_queue_directory} %{name} 2> /dev/null || :
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%pre mysql
|
|
#echo "PARAM_pre: "$1
|
|
# on `rpm -ivh` PARAM is 1
|
|
# on `rpm -Uvh` PARAM is 2
|
|
if [ "$1" = "1" ]; then
|
|
echo "Adding %{vmusr} user"
|
|
if [ -z "`%{_bindir}/getent group %{vmusr} 2>/dev/null`" ]; then
|
|
%{_sbindir}/groupadd -r -g %{vmgid} %{vmusr}
|
|
fi
|
|
if [ -z "`%{_bindir}/getent passwd %{vmusr} 2>/dev/null`" ]; then
|
|
%{_sbindir}/useradd -c "maildirs chef" -d %{vmdir} -g %{vmusr} -u %{vmid} -r -s /bin/false %{vmusr}
|
|
fi
|
|
fi
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%preun
|
|
%stop_on_removal %{name}
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%preun mysql
|
|
#echo "PARAM_preun: "$1
|
|
# on `rpm -e` PARAM is 0
|
|
if [ "$1" = "0" ]; then
|
|
FILE=etc/%{name}/dynamicmaps.cf
|
|
if [ -e "$FILE" ] ; then
|
|
if grep -q "^mysql[[:space:]]" ${FILE}; then
|
|
echo "Removing mysql map entry from ${FILE}"
|
|
sed "/^mysql[[:space:]]/d" ${FILE} > ${FILE}.$$ && \
|
|
cp --remove-destination ${FILE}.$$ ${FILE} && \
|
|
rm ${FILE}.$$
|
|
fi
|
|
else
|
|
echo "Can not find \"$FILE\". Not updating the file." >&2
|
|
fi
|
|
echo "Removing %{vmusr} user"
|
|
userdel %{vmusr} 2> /dev/null
|
|
groupdel %{vmusr} 2> /dev/null
|
|
fi
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%preun postgresql
|
|
if [ "$1" = 0 ] ; then
|
|
FILE=etc/%{name}/dynamicmaps.cf
|
|
if [ -e "$FILE" ] ; then
|
|
if grep -q "^pgsql[[:space:]]" ${FILE}; then
|
|
echo "Removing pgsql map entry from ${FILE}"
|
|
sed "/^pgsql[[:space:]]/d" ${FILE} > ${FILE}.$$ && \
|
|
cp --remove-destination ${FILE}.$$ ${FILE} && \
|
|
rm ${FILE}.$$
|
|
fi
|
|
else
|
|
echo "Can not find \"$FILE\". Not updating the file." >&2
|
|
fi
|
|
fi
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%post
|
|
%{fillup_and_insserv -y postfix}
|
|
# We never have to run suseconfig for postfix after installation
|
|
# We only start postfix own upgrade-configuration by update
|
|
if [ ${1:-0} -gt 1 ]; then
|
|
echo "executing upgrade-configuration"
|
|
/usr/sbin/%{name} set-permissions upgrade-configuration setgid_group=%{pf_setgid_group}
|
|
#New map in 11.2 #TODO remove it later
|
|
. /etc/sysconfig/postfix
|
|
RELAY=`echo $POSTFIX_MAP_LIST | grep -P " relay | relay$"`
|
|
if [ -z "$RELAY" ]
|
|
then
|
|
sed -i "s/^POSTFIX_MAP_LIST=.*/POSTFIX_MAP_LIST=\"$POSTFIX_MAP_LIST relay\"/" /etc/sysconfig/postfix
|
|
fi
|
|
if [ ! -e /var/adm/BNC-555814.fixed ]
|
|
then
|
|
sed -i 's/SMTPD_LISTEN_REMOTE=.*/SMTPD_LISTEN_REMOTE=""/' /etc/sysconfig/mail
|
|
touch /var/adm/BNC-555814.fixed
|
|
fi
|
|
fi
|
|
ldconfig
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%postun
|
|
%restart_on_update %{name}
|
|
%insserv_cleanup
|
|
ldconfig
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%post postgresql
|
|
FILE=etc/%{name}/dynamicmaps.cf
|
|
if ! grep -q "^pgsql[[:space:]]" ${FILE}; then
|
|
echo "Adding pgsql map entry to ${FILE}"
|
|
echo "pgsql /usr/lib/%{name}/dict_pgsql.so dict_pgsql_open" >> ${FILE}
|
|
fi
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%post mysql
|
|
FILE=etc/%{name}/dynamicmaps.cf
|
|
if ! grep -q "^mysql[[:space:]]" ${FILE}; then
|
|
echo "Adding mysql map entry to ${FILE}"
|
|
echo "mysql /usr/lib/%{name}/dict_mysql.so dict_mysql_open" >> ${FILE}
|
|
fi
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%clean
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
%files -f %{postfixfiles}
|
|
%defattr(-,root,root)
|
|
%config /etc/pam.d/*
|
|
/var/adm/fillup-templates/sysconfig.%{name}
|
|
/var/adm/fillup-templates/sysconfig.mail-%{name}
|
|
/sbin/conf.d/SuSEconfig.%{name}
|
|
%config(noreplace) %{omc_dir}/%{name}.xml
|
|
%dir /etc/%{name}
|
|
%config(noreplace) /etc/%{name}/access
|
|
%config(noreplace) /etc/%{name}/generic
|
|
%config(noreplace) /etc/%{name}/helo_access
|
|
%config(noreplace) /etc/%{name}/canonical
|
|
#%config(noreplace) /etc/%{name}/cidr_table
|
|
%config(noreplace) /etc/%{name}/main.cf
|
|
%config /etc/%{name}/main.cf.default
|
|
%config(noreplace) /etc/%{name}/master.cf
|
|
%config(noreplace) /etc/%{name}/openssl_%{name}.conf.in
|
|
%config(noreplace) /etc/%{name}/relocated
|
|
%config(noreplace) /etc/%{name}/transport
|
|
%config(noreplace) /etc/%{name}/virtual
|
|
%config(noreplace) /etc/%{name}/sasl_passwd
|
|
%config(noreplace) /etc/%{name}/sender_canonical
|
|
#%config(noreplace) /etc/%{name}/tcp_table
|
|
#%config(noreplace) /etc/%{name}/pcre_table
|
|
#%config(noreplace) /etc/%{name}/regexp_table
|
|
%config(noreplace) /etc/%{name}/relay
|
|
%config(noreplace) /etc/%{name}/relay_ccerts
|
|
%config(noreplace) /etc/%{name}/header_checks
|
|
%config(noreplace) /etc/%{name}/bounce.cf.default
|
|
%config(noreplace) /etc/%{name}/dynamicmaps.cf
|
|
%config /etc/sysconfig/SuSEfirewall2.d/services/%{name}
|
|
%dir /etc/sasl2/
|
|
%config(noreplace) /etc/sasl2/smtpd.conf
|
|
%config /etc/%{name}/LICENSE
|
|
%if %{usetls}
|
|
%config /etc/%{name}/TLS_LICENSE
|
|
%endif
|
|
%config /etc/permissions.d/%{name}
|
|
%config /etc/permissions.d/%{name}.paranoid
|
|
%attr(0644, root, root) %config /etc/%{name}/makedefs.out
|
|
%attr(0644, root, root) %config /etc/%{name}/%{name}-files
|
|
/usr/lib/%{name}/%{name}-files
|
|
%config %attr(0755,root,root) /etc/init.d/%{name}
|
|
/usr/bin/mailq
|
|
/usr/bin/newaliases
|
|
%attr(0755, root, root) /usr/sbin/sendmail
|
|
/usr/sbin/qmqp-source
|
|
/usr/sbin/smtp-sink
|
|
/usr/sbin/smtp-source
|
|
/usr/sbin/mk%{name}cert
|
|
/sbin/rc%{name}
|
|
%{_libdir}/lib*
|
|
/usr/lib/sendmail
|
|
%dir /usr/lib/%{name}
|
|
/usr/lib/%{name}/*[^.so]
|
|
/usr/lib/%{name}/dict_ldap.so
|
|
/usr/lib/%{name}/dict_pcre.so
|
|
/usr/lib/%{name}/dict_tcp.so
|
|
%{conf_backup_dir}
|
|
%dir %attr(0700,%{name},root) %{pf_data_directory}
|
|
%{_mandir}/man?/*.gz
|
|
|
|
%files devel
|
|
%defattr(-,root,root)
|
|
/usr/include/%{name}/
|
|
|
|
%files doc
|
|
%defattr(0644,root,root,0755)
|
|
%dir %{pf_docdir}/
|
|
%{pf_docdir}/
|
|
|
|
%files mysql
|
|
%defattr(-,root,root)
|
|
%doc %{name}-mysql/%{name}-mysql.sql
|
|
%config(noreplace) %attr(640, root, %{name}) /etc/%{name}/*_maps.cf
|
|
%config(noreplace) /etc/%{name}/main.cf-mysql
|
|
/usr/lib/%{name}/dict_mysql.so
|
|
|
|
%files postgresql
|
|
%defattr(-,root,root)
|
|
/usr/lib/%{name}/dict_pgsql.so
|
|
|
|
%changelog
|