Accepting request 281994 from home:pluskalm:branches:server:mail

- Don't install sysvinit script when systemd is used
- Make explicit PreReq dependencies conditional only for older 
  systems
- Don't try to set explicit attributes to symlinks
- Cleanup spec file vith spec-cleaner

OBS-URL: https://build.opensuse.org/request/show/281994
OBS-URL: https://build.opensuse.org/package/show/server:mail/postfix?expand=0&rev=208
This commit is contained in:
Tomáš Chvátal 2015-01-27 11:52:31 +00:00 committed by Git OBS Bridge
parent 8e99aee374
commit b02e8e05b9
2 changed files with 258 additions and 236 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Jan 19 22:15:30 UTC 2015 - mpluskal@suse.com
- Don't install sysvinit script when systemd is used
- Make explicit PreReq dependencies conditional only for older
systems
- Don't try to set explicit attributes to symlinks
- Cleanup spec file vith spec-cleaner
-------------------------------------------------------------------
Tue Jan 13 07:04:52 UTC 2015 - varkoly@suse.com

View File

@ -16,14 +16,48 @@
#
#
# Some defines
#
%define pf_docdir %{_docdir}/%{name}-doc
%define pf_config_directory %{_sysconfdir}/%{name}
%define pf_daemon_directory %{_libexecdir}/%{name}
%define pf_command_directory %{_prefix}/sbin
%define pf_queue_directory var/spool/%{name}
%define pf_sendmail_path %{_sbindir}/sendmail
%define pf_newaliases_path %{_bindir}/newaliases
%define pf_mailq_path %{_bindir}/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 %{_localstatedir}/lib/%{name}
%define pf_uid 51
%define pf_gid 51
%define maildrop_gid 59
%define mail_gid 12
%define conf_backup_dir %{_localstatedir}/adm/backup/%{name}
%define omc_pdir %{_datadir}/omc/
%define omc_dir %{_datadir}/omc/svcinfo.d/
#
%define vmusr vmail
%define vmgid 303
%define vmid 303
%define vmdir /srv/maildirs
#
# ---------------------------------------------------------------------------
%if 0%{?suse_version} > 1220
%define _unitdir %{_libexecdir}/systemd
%else
%define _unitdir /lib/systemd
%endif
Name: postfix
Version: 2.11.3
Release: 0
Summary: A fast, secure, and flexible mailer
License: IPL-1.0
Group: Productivity/Networking/Email/Servers
Version: 2.11.3
Release: 0
Url: http://www.postfix.org/
Source: http://www.artfiles.org/postfix.org/postfix-release/official/postfix-%{version}.tar.gz
#Source1: postfix-%{version}.tar.gz.asc
Source2: %{name}-SuSE.tar.gz
@ -44,17 +78,6 @@ Patch100: %{name}-vda-v13-2.10.0.patch
Patch101: postfix-db6.diff
#PATCH-FIX-SLE PATCH-FIX-OPENSUSE to be able to build the agent tls_proxy
Patch102: add_missed_library.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %insserv_prereq %fillup_prereq
PreReq: /usr/bin/getent
PreReq: /usr/sbin/useradd /usr/sbin/groupadd /usr/sbin/usermod
PreReq: /bin/sed /bin/awk /bin/grep
PreReq: textutils sh-utils fileutils pcre netcfg
PreReq: permissions
%if 0%{?suse_version} > 1130
PreReq: sysvinit(syslog) sysvinit(network)
%endif
Requires: iproute2
BuildRequires: cyrus-sasl-devel
BuildRequires: db-devel
BuildRequires: libopenssl-devel
@ -62,54 +85,35 @@ BuildRequires: mysql-devel
BuildRequires: openldap2-devel
BuildRequires: pcre-devel
BuildRequires: postgresql-devel
# require pwdutils to make postinstall script check work
BuildRequires: pwdutils
Requires: iproute2
Requires(pre): permissions
Requires(pre): %insserv_prereq
Requires(pre): %fillup_prereq
Provides: smtp_daemon
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Conflicts: sendmail exim
%if 0%{?suse_version} > 1130
Requires(pre): sysvinit(network)
Requires(pre): sysvinit(syslog)
%endif
%if 0%{?suse_version} >= 1100
BuildRequires: fdupes
%endif
%if 0%{?suse_version} > 1140
%if 0%{?suse_version} > 1210
BuildRequires: systemd
%{?systemd_requires}
%endif
#
Conflicts: sendmail exim
Provides: smtp_daemon
#
# Some defines
#
%define pf_docdir %{_docdir}/%{name}-doc
%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 mail_gid 12
%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
#
# ---------------------------------------------------------------------------
%if %suse_version > 1220
%define _unitdir /usr/lib/systemd
%else
%define _unitdir /lib/systemd
Requires(pre): %insserv_prereq %fillup_prereq
Requires(pre): %{_bindir}/getent
Requires(pre): pwdutils
Requires(pre): /bin/awk
Requires(pre): /bin/grep
Requires(pre): /bin/sed
Requires(pre): fileutils
Requires(pre): netcfg
Requires(pre): pcre
Requires(pre): sh-utils
Requires(pre): textutils
%endif
%description
@ -118,7 +122,7 @@ Postfix aims to be an alternative to the widely-used sendmail program.
%package devel
Summary: Development headers for the postfix package
Group: Development/Libraries/C and C++
PreReq: %{name} = %{version}
Requires(pre): %{name} = %{version}
%description devel
Postfix aims to be an alternative to the widely-used sendmail program.
@ -137,7 +141,7 @@ This package contains the documentation for %{name}
%package mysql
Summary: Postfix plugin to support MySQL maps
Group: Productivity/Networking/Email/Servers
PreReq: %{name} = %{version}
Requires(pre): %{name} = %{version}
%description mysql
Postfix plugin to support MySQL maps. This library will be loaded by
@ -146,7 +150,7 @@ starting %{name} if you'll access a postmap which is stored in mysql.
%package postgresql
Summary: Postfix plugin to support PostgreSQL maps
Group: Productivity/Networking/Email/Servers
PreReq: %{name} = %{version}
Requires(pre): %{name} = %{version}
%description postgresql
Postfix plugin to support PostgreSQL maps. This library will be loaded
@ -170,16 +174,16 @@ PostgreSQL.
# ---------------------------------------------------------------------------
%build
export CCARGS="-DHAS_LDAP -DHAS_PCRE -DUSE_SASL_AUTH -I/usr/include/sasl"
export CCARGS="-DHAS_LDAP -DHAS_PCRE -DUSE_SASL_AUTH -I%{_includedir}/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 -DHAS_MYSQL -I%{_includedir}/mysql"
export CCARGS="$CCARGS -DHAS_PGSQL -I%{_includedir}/pgsql"
export CCARGS="$CCARGS -DUSE_CYRUS_SASL"
export AUXLIBS="-lldap -llber -lpcre"
export AUXLIBS="$AUXLIBS -lsasl2"
export AUXLIBS="$AUXLIBS -lssl -lcrypto"
export CCARGS="$CCARGS -DUSE_TLS"
export CCARGS="$CCARGS $RPM_OPT_FLAGS -Wno-comments"
export CCARGS="$CCARGS %{optflags} -Wno-comments"
export PIE=-pie
make makefiles DEBUG=""
cd lib
@ -191,22 +195,22 @@ 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 || :
/usr/sbin/usermod -G %{maildrop_gid},%{mail_gid} %{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
groupadd -g %{pf_gid} -o -r %{name} 2> /dev/null || :
groupadd -g %{maildrop_gid} -o -r maildrop 2> /dev/null || :
useradd -r -o -g %{name} -u %{pf_uid} -s /bin/false -c "Postfix Daemon" -d /%{pf_queue_directory} %{name} 2> /dev/null || :
usermod -G %{maildrop_gid},%{mail_gid} %{name} 2> /dev/null || :
mkdir -p %{buildroot}/%{_libdir}
install lib/*.1 %{buildroot}/%{_libdir}
for i in %{buildroot}/%{_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
ln -sf $i %{buildroot}/%{_libdir}/${i%{so}.*}so
done
cd -
ln -sf $(pwd)/lib/dict_* libexec/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RPM_BUILD_ROOT/%{_libdir}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}/%{_libdir}
sh postfix-install -non-interactive \
install_root=%{buildroot} \
config_directory=%{pf_config_directory} \
@ -220,28 +224,26 @@ sh postfix-install -non-interactive \
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
ln -sf ../sbin/sendmail %{buildroot}%{_libexecdir}/sendmail
for i in qmqp-source smtp-sink smtp-source; do
install -m 755 bin/$i $RPM_BUILD_ROOT/usr/sbin/$i
install -m 755 bin/$i %{buildroot}%{_sbindir}/$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/%{pf_html_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 -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}/sbin/conf.d
mkdir -p %{buildroot}%{_sysconfdir}/permissions.d
mkdir -p %{buildroot}/%{_libdir}/sasl2
mkdir -p %{buildroot}%{_prefix}/sbin
mkdir -p %{buildroot}/%{conf_backup_dir}
mkdir -p %{buildroot}/%{pf_sample_directory}
mkdir -p %{buildroot}/%{pf_html_directory}
mkdir -p %{buildroot}%{_includedir}/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/pam.d
install -m 644 %{name}-SuSE/smtp %{buildroot}%{_sysconfdir}/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}
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
rm -f %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
sed -e 's;@lib@;%{_lib};g' %{name}-SuSE/sysconfig.%{name} > %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
install -m 644 %{name}-SuSE/sysconfig.mail-%{name} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.mail-%{name}
sed -e 's;@lib@;%{_lib};g' \
-e 's;@conf_backup_dir@;%{conf_backup_dir};' \
-e 's;@daemon_directory@;%{pf_daemon_directory};' \
@ -252,24 +254,24 @@ sed -e 's;@lib@;%{_lib};g' \
-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/config.%{name} > $RPM_BUILD_ROOT/usr/sbin/config.%{name}
chmod 755 $RPM_BUILD_ROOT/usr/sbin/config.%{name}
install -m 644 %{name}-SuSE/dynamicmaps.cf $RPM_BUILD_ROOT/etc/%{name}/dynamicmaps.cf
install -m 644 %{name}-SuSE/ldap_aliases.cf $RPM_BUILD_ROOT/etc/%{name}/ldap_aliases.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
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/smtp
-e 's;@mailq_path@;%{pf_mailq_path};' %{name}-SuSE/config.%{name} > %{buildroot}%{_sbindir}/config.%{name}
chmod 755 %{buildroot}%{_sbindir}/config.%{name}
install -m 644 %{name}-SuSE/dynamicmaps.cf %{buildroot}%{_sysconfdir}/%{name}/dynamicmaps.cf
install -m 644 %{name}-SuSE/ldap_aliases.cf %{buildroot}%{_sysconfdir}/%{name}/ldap_aliases.cf
install -m 644 %{name}-SuSE/helo_access %{buildroot}%{_sysconfdir}/postfix/helo_access
install -m 644 %{name}-SuSE/permissions %{buildroot}%{_sysconfdir}/permissions.d/%{name}
install -m 644 %{name}-SuSE/sender_canonical %{buildroot}%{_sysconfdir}/%{name}/sender_canonical
install -m 644 %{name}-SuSE/relay %{buildroot}%{_sysconfdir}/postfix/relay
install -m 644 %{name}-SuSE/relay_ccerts %{buildroot}%{_sysconfdir}/%{name}/relay_ccerts
install -m 600 %{name}-SuSE/sasl_passwd %{buildroot}%{_sysconfdir}/%{name}/sasl_passwd
mkdir -p %{buildroot}%{_sysconfdir}/sasl2
install -m 600 %{name}-SuSE/smtpd.conf %{buildroot}%{_sysconfdir}/sasl2/smtpd.conf
install -m 644 %{name}-SuSE/openssl_%{name}.conf.in %{buildroot}%{_sysconfdir}/%{name}/openssl_%{name}.conf.in
install -m 755 %{name}-SuSE/mk%{name}cert %{buildroot}%{_sbindir}/mk%{name}cert
mkdir -p %{buildroot}/%{omc_dir}
install -m 644 %{name}-SuSE/%{name}.xml %{buildroot}/%{omc_dir}
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
install -m 644 %{name}-SuSE/%{name}-fw %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/smtp
{
cat<<EOF
#
@ -282,8 +284,8 @@ cat<<EOF
#
EOF
cat conf/main.cf
} > $RPM_BUILD_ROOT/etc/%{name}/main.cf
$RPM_BUILD_ROOT/usr/sbin/postconf -c $RPM_BUILD_ROOT/etc/%{name} \
} > %{buildroot}%{_sysconfdir}/%{name}/main.cf
%{buildroot}%{_sbindir}/postconf -c %{buildroot}%{_sysconfdir}/%{name} \
-e "manpage_directory = %{_mandir}" \
"setgid_group = %{pf_setgid_group}" \
"mailq_path = %{pf_mailq_path}" \
@ -298,41 +300,45 @@ $RPM_BUILD_ROOT/usr/sbin/postconf -c $RPM_BUILD_ROOT/etc/%{name} \
"disable_vrfy_command = yes" \
'smtpd_banner = $myhostname ESMTP'
#Set Permissions
install -m 644 %{name}-SuSE/%{name}-files $RPM_BUILD_ROOT/usr/lib/postfix/postfix-files
install -m 644 %{name}-SuSE/%{name}-files %{buildroot}%{_libexecdir}/postfix/postfix-files
# 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}/
install -m 644 %{name}-mysql/main.cf-mysql %{buildroot}%{_sysconfdir}/%{name}/main.cf-mysql
install -m 640 %{name}-mysql/*_maps.cf %{buildroot}%{_sysconfdir}/%{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}/
printf '%%-38s %%-18s %%s\n' %{_sbindir}/postdrop "root.%{pf_setgid_group}" "0755" >> %{buildroot}%{_sysconfdir}/permissions.d/%{name}.paranoid
printf '%%-38s %%-18s %%s\n' %{_sbindir}/postqueue "root.%{pf_setgid_group}" "0755" >> %{buildroot}%{_sysconfdir}/permissions.d/%{name}.paranoid
install -m 644 include/*.h %{buildroot}%{_includedir}/%{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}
rm examples/chroot-setup/${example}
done
cp -a examples/* $RPM_BUILD_ROOT%{pf_sample_directory}
cp -a html/* $RPM_BUILD_ROOT%{pf_html_directory}
cp -a auxiliary/ $RPM_BUILD_ROOT%{pf_docdir}/
%if 0%{?suse_version} >= 1140
cp -a examples/* %{buildroot}%{pf_sample_directory}
cp -a html/* %{buildroot}%{pf_html_directory}
cp -a auxiliary/ %{buildroot}%{pf_docdir}/
%if 0%{?suse_version} >= 1210
mkdir -p %{buildroot}%{_unitdir}/system
mkdir -p %{buildroot}/etc/postfix/system
mkdir -p %{buildroot}%{_sysconfdir}/postfix/system
install -m 0644 %{name}-SuSE/postfix.service %{buildroot}%{_unitdir}/system/postfix.service
install -m 0755 %{name}-SuSE/config_postfix.systemd %{buildroot}/etc/postfix/system/config_postfix
install -m 0755 %{name}-SuSE/update_chroot.systemd %{buildroot}/etc/postfix/system/update_chroot
install -m 0755 %{name}-SuSE/update_postmaps.systemd %{buildroot}/etc/postfix/system/update_postmaps
install -m 0755 %{name}-SuSE/wait_qmgr.systemd %{buildroot}/etc/postfix/system/wait_qmgr
install -m 0755 %{name}-SuSE/cond_slp.systemd %{buildroot}/etc/postfix/system/cond_slp
install -m 0755 %{name}-SuSE/config_postfix.systemd %{buildroot}%{_sysconfdir}/postfix/system/config_postfix
install -m 0755 %{name}-SuSE/update_chroot.systemd %{buildroot}%{_sysconfdir}/postfix/system/update_chroot
install -m 0755 %{name}-SuSE/update_postmaps.systemd %{buildroot}%{_sysconfdir}/postfix/system/update_postmaps
install -m 0755 %{name}-SuSE/wait_qmgr.systemd %{buildroot}%{_sysconfdir}/postfix/system/wait_qmgr
install -m 0755 %{name}-SuSE/cond_slp.systemd %{buildroot}%{_sysconfdir}/postfix/system/cond_slp
ln -sv %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%else
install -m 755 %{name}-SuSE/rc.%{name} %{buildroot}%{_initddir}/%{name}
ln -s -f %{_initddir}/%{name} %{buildroot}%{_sbindir}/rc%{name}
%endif
%if 0%{?suse_version} >= 1100
%fdupes $RPM_BUILD_ROOT%{pf_docdir}
%fdupes $RPM_BUILD_ROOT%{_mandir}
%fdupes %{buildroot}%{pf_docdir}
%fdupes %{buildroot}%{_mandir}
%endif
# ---------------------------------------------------------------------------
install -m 755 %{SOURCE11} $RPM_BUILD_ROOT/usr/sbin/
install -m 755 %{SOURCE11} %{buildroot}%{_sbindir}/
%pre
%if 0%{?suse_version} > 1140
%if 0%{?suse_version} > 1210
%service_add_pre %{name}.service
%endif
@ -344,10 +350,10 @@ if [ -z "$VERSIONTEST" -a -f %{pf_queue_directory}/pid/master.pid ]; then
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 || :
/usr/sbin/usermod -G %{maildrop_gid},%{mail_gid} %{name} 2> /dev/null || :
%{_sbindir}/groupadd -g %{pf_gid} -o -r %{name} 2> /dev/null || :
%{_sbindir}/groupadd -g %{maildrop_gid} -o -r maildrop 2> /dev/null || :
%{_sbindir}/useradd -r -o -g %{name} -u %{pf_uid} -s /bin/false -c "Postfix Daemon" -d /%{pf_queue_directory} %{name} 2> /dev/null || :
%{_sbindir}/usermod -G %{maildrop_gid},%{mail_gid} %{name} 2> /dev/null || :
# ---------------------------------------------------------------------------
%pre mysql
@ -356,24 +362,24 @@ fi
# 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}
if [ -z "`getent group %{vmusr} 2>/dev/null`" ]; then
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}
if [ -z "`getent passwd %{vmusr} 2>/dev/null`" ]; then
useradd -c "maildirs chef" -d %{vmdir} -g %{vmusr} -u %{vmid} -r -s /bin/false %{vmusr}
fi
fi
# ---------------------------------------------------------------------------
%preun
%stop_on_removal %{name}
%if 0%{?suse_version} > 1140
%if 0%{?suse_version} > 1210
%service_del_preun %{name}.service
%endif
# ---------------------------------------------------------------------------
%preun mysql
#echo "PARAM_preun: "$1
#echo "PARAM_preun: "$1
# on `rpm -e` PARAM is 0
if [ "$1" = "0" ]; then
FILE=etc/%{name}/dynamicmaps.cf
@ -413,52 +419,61 @@ fi
# 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
touch /var/adm/postfix.configured
touch %{_localstatedir}/adm/postfix.configured
# Check if main.cf and master.cf was changed manualy
MAINCH=0
if [ -e /var/adm/SuSEconfig/md5/etc/postfix/main.cf ]; then
MD5SUM1=$( cat /var/adm/SuSEconfig/md5/etc/postfix/main.cf )
MD5SUM2=$( grep -v "^#" /etc/postfix/main.cf | md5sum )
if [ -e %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/main.cf ]; then
MD5SUM1=$( cat %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/main.cf )
MD5SUM2=$( grep -v "^#" %{_sysconfdir}/postfix/main.cf | md5sum )
if [ "$MD5SUM1" != "$MD5SUM2" ]; then
MAINCH=1
fi
fi
MASTERCH=0
if [ -e /var/adm/SuSEconfig/md5/etc/postfix/master.cf ]; then
MD5SUM1=$( cat /var/adm/SuSEconfig/md5/etc/postfix/master.cf )
MD5SUM2=$( grep -v "^#" /etc/postfix/master.cf | md5sum )
if [ -e %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/master.cf ]; then
MD5SUM1=$( cat %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/master.cf )
MD5SUM2=$( grep -v "^#" %{_sysconfdir}/postfix/master.cf | md5sum )
if [ "$MD5SUM1" != "$MD5SUM2" ]; then
MASTERCH=1
fi
fi
echo "Executing upgrade-configuration."
/usr/sbin/postfix set-permissions upgrade-configuration setgid_group=%{pf_setgid_group} || :
%{_sbindir}/postfix set-permissions upgrade-configuration setgid_group=%{pf_setgid_group} || :
if [ $MASTERCH -eq 0 ]; then
test -e /var/adm/SuSEconfig/md5/etc/postfix/master.cf && grep -v "^#" /etc/postfix/master.cf | md5sum > /var/adm/SuSEconfig/md5/etc/postfix/master.cf
test -e %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/master.cf && grep -v "^#" %{_sysconfdir}/postfix/master.cf | md5sum > %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/master.cf
fi
if [ $MAINCH -eq 0 ]; then
test -e /var/adm/SuSEconfig/md5/etc/postfix/main.cf && grep -v "^#" /etc/postfix/main.cf | md5sum > /var/adm/SuSEconfig/md5/etc/postfix/main.cf
test -e %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/main.cf && grep -v "^#" %{_sysconfdir}/postfix/main.cf | md5sum > %{_localstatedir}/adm/SuSEconfig/md5%{_sysconfdir}/postfix/main.cf
fi
fi
%{fillup_and_insserv -y postfix}
%{fillup_only -an mail}
%if 0%{?suse_version} > 1140
%if 0%{?suse_version} > 1210
%service_add_post %{name}.service
%set_permissions /usr/sbin/postqueue
%set_permissions /usr/sbin/postdrop
%set_permissions %{_sbindir}/postqueue
%set_permissions %{_sbindir}/postdrop
%set_permissions %{_sysconfdir}/%{name}/sasl_passwd
%set_permissions %{_sbindir}/sendmail
%verifyscript
%verify_permissions -e /usr/sbin/postqueue -e /usr/sbin/postdrop
%verify_permissions -e %{_sbindir}/postqueue
%verify_permissions -e %{_sbindir}/postdrop
%verify_permissions -e %{_sysconfdir}/%{name}/sasl_passwd
%verify_permissions -e %{_sbindir}/sendmail
%{fillup_only -y postfix}
%else
%{fillup_and_insserv -y postfix}
%endif
%{fillup_only -an mail}
/sbin/ldconfig
# ---------------------------------------------------------------------------
%postun
%restart_on_update %{name}
%insserv_cleanup
/sbin/ldconfig
%if 0%{?suse_version} > 1140
%if 0%{?suse_version} > 1210
%service_del_postun %{name}.service
%endif
/sbin/ldconfig
# ---------------------------------------------------------------------------
@ -466,7 +481,7 @@ fi
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}
echo "pgsql %{_libexecdir}/%{name}/dict_pgsql.so dict_pgsql_open" >> ${FILE}
fi
# ---------------------------------------------------------------------------
@ -474,86 +489,84 @@ fi
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}
echo "mysql %{_libexecdir}/%{name}/dict_mysql.so dict_mysql_open" >> ${FILE}
fi
# ---------------------------------------------------------------------------
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc LICENSE
%config /etc/pam.d/*
/var/adm/fillup-templates/sysconfig.%{name}
/var/adm/fillup-templates/sysconfig.mail-%{name}
/usr/sbin/config.%{name}
%config %{_sysconfdir}/pam.d/*
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%{_localstatedir}/adm/fillup-templates/sysconfig.mail-%{name}
%{_sbindir}/config.%{name}
%config(noreplace) %{omc_dir}/%{name}.xml
%dir /etc/%{name}
%config /etc/%{name}/main.cf.default
%config(noreplace) /etc/%{name}/access
%config(noreplace) /etc/%{name}/aliases
%config(noreplace) /etc/%{name}/generic
%config(noreplace) /etc/%{name}/helo_access
%config(noreplace) /etc/%{name}/canonical
%config(noreplace) /etc/%{name}/main.cf
%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}/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(noreplace) /etc/%{name}/ldap_aliases.cf
%config /etc/sysconfig/SuSEfirewall2.d/services/smtp
%dir /etc/sasl2/
%config(noreplace) /etc/sasl2/smtpd.conf
%config /etc/%{name}/LICENSE
%config /etc/%{name}/TLS_LICENSE
%config /etc/permissions.d/%{name}
%config /etc/permissions.d/%{name}.paranoid
%attr(0644, root, root) %config /etc/%{name}/makedefs.out
/usr/lib/%{name}/%{name}-files
%config %attr(0755,root,root) /etc/init.d/%{name}
%if 0%{?suse_version} >= 1140
%dir /etc/postfix/system
%config %attr(0755,root,root) /etc/postfix/system/*
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/main.cf.default
%config(noreplace) %{_sysconfdir}/%{name}/access
%config(noreplace) %{_sysconfdir}/%{name}/aliases
%config(noreplace) %{_sysconfdir}/%{name}/generic
%config(noreplace) %{_sysconfdir}/%{name}/helo_access
%config(noreplace) %{_sysconfdir}/%{name}/canonical
%config(noreplace) %{_sysconfdir}/%{name}/main.cf
%config(noreplace) %{_sysconfdir}/%{name}/master.cf
%config(noreplace) %{_sysconfdir}/%{name}/openssl_%{name}.conf.in
%config(noreplace) %{_sysconfdir}/%{name}/relocated
%config(noreplace) %{_sysconfdir}/%{name}/transport
%config(noreplace) %{_sysconfdir}/%{name}/virtual
%config(noreplace) %{_sysconfdir}/%{name}/sasl_passwd
%config(noreplace) %{_sysconfdir}/%{name}/sender_canonical
%config(noreplace) %{_sysconfdir}/%{name}/relay
%config(noreplace) %{_sysconfdir}/%{name}/relay_ccerts
%config(noreplace) %{_sysconfdir}/%{name}/header_checks
%config(noreplace) %{_sysconfdir}/%{name}/bounce.cf.default
%config(noreplace) %{_sysconfdir}/%{name}/dynamicmaps.cf
%config(noreplace) %{_sysconfdir}/%{name}/ldap_aliases.cf
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/smtp
%dir %{_sysconfdir}/sasl2/
%config(noreplace) %{_sysconfdir}/sasl2/smtpd.conf
%config %{_sysconfdir}/%{name}/LICENSE
%config %{_sysconfdir}/%{name}/TLS_LICENSE
%config %{_sysconfdir}/permissions.d/%{name}
%config %{_sysconfdir}/permissions.d/%{name}.paranoid
%attr(0644, root, root) %config %{_sysconfdir}/%{name}/makedefs.out
%{_libexecdir}/%{name}/%{name}-files
%if 0%{?suse_version} >= 1210
%dir %{_sysconfdir}/postfix/system
%config %attr(0755,root,root) %{_sysconfdir}/postfix/system/*
%config %{_unitdir}/system/postfix.service
%else
%config %attr(0755,root,root) %{_initddir}/%{name}
%endif
%verify(not mode) %attr(2755,root,%{pf_setgid_group}) /usr/sbin/postdrop
%verify(not mode) %attr(2755,root,%{pf_setgid_group}) /usr/sbin/postqueue
%attr(0755,root,root) /usr/bin/mailq
%attr(0755,root,root) /usr/bin/newaliases
%attr(0755,root,root) /usr/sbin/sendmail
%attr(0755,root,root) /usr/sbin/postalias
%attr(0755,root,root) /usr/sbin/postcat
%attr(0755,root,root) /usr/sbin/postconf
%attr(0755,root,root) /usr/sbin/postfix
%attr(0755,root,root) /usr/sbin/postkick
%attr(0755,root,root) /usr/sbin/postlock
%attr(0755,root,root) /usr/sbin/postlog
%attr(0755,root,root) /usr/sbin/postmap
%attr(0755,root,root) /usr/sbin/postmulti
%attr(0755,root,root) /usr/sbin/postsuper
%attr(0755,root,root) /usr/sbin/qmqp-source
%attr(0755,root,root) /usr/sbin/smtp-sink
%attr(0755,root,root) /usr/sbin/smtp-source
%attr(0755,root,root) /usr/sbin/mkpostfixcert
%attr(0755,root,root) /usr/sbin/check_mail_queue
%attr(0755,root,root) /usr/sbin/config.postfix
%attr(0755,root,root) /sbin/rc%{name}
%verify(not mode) %attr(2755,root,%{pf_setgid_group}) %{_sbindir}/postdrop
%verify(not mode) %attr(2755,root,%{pf_setgid_group}) %{_sbindir}/postqueue
%{_bindir}/mailq
%{_bindir}/newaliases
%attr(0755,root,root) %{_sbindir}/sendmail
%attr(0755,root,root) %{_sbindir}/postalias
%attr(0755,root,root) %{_sbindir}/postcat
%attr(0755,root,root) %{_sbindir}/postconf
%attr(0755,root,root) %{_sbindir}/postfix
%attr(0755,root,root) %{_sbindir}/postkick
%attr(0755,root,root) %{_sbindir}/postlock
%attr(0755,root,root) %{_sbindir}/postlog
%attr(0755,root,root) %{_sbindir}/postmap
%attr(0755,root,root) %{_sbindir}/postmulti
%attr(0755,root,root) %{_sbindir}/postsuper
%attr(0755,root,root) %{_sbindir}/qmqp-source
%attr(0755,root,root) %{_sbindir}/smtp-sink
%attr(0755,root,root) %{_sbindir}/smtp-source
%attr(0755,root,root) %{_sbindir}/mkpostfixcert
%attr(0755,root,root) %{_sbindir}/check_mail_queue
%attr(0755,root,root) %{_sbindir}/config.postfix
%{_sbindir}/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
%{_libexecdir}/sendmail
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/*[^.so]
%{_libexecdir}/%{name}/dict_ldap.so
%{_libexecdir}/%{name}/dict_pcre.so
%{_libexecdir}/%{name}/dict_tcp.so
%{conf_backup_dir}
%dir %attr(0700,%{name},root) %{pf_data_directory}
%{_mandir}/man?/*.gz
@ -574,7 +587,7 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(-,root,root)
/usr/include/%{name}/
%{_includedir}/%{name}/
%files doc
%defattr(0644,root,root,0755)
@ -583,12 +596,12 @@ rm -rf $RPM_BUILD_ROOT
%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
%config(noreplace) %attr(640, root, %{name}) %{_sysconfdir}/%{name}/*_maps.cf
%config(noreplace) %{_sysconfdir}/%{name}/main.cf-mysql
%{_libexecdir}/%{name}/dict_mysql.so
%files postgresql
%defattr(-,root,root)
/usr/lib/%{name}/dict_pgsql.so
%{_libexecdir}/%{name}/dict_pgsql.so
%changelog