spec file cleanup
This commit is contained in:
parent
4e11662dbe
commit
9aea43c6d8
69
dovecot.spec
69
dovecot.spec
@ -39,13 +39,8 @@ BuildRequires: gcc, gcc-c++, openssl-devel, pam-devel, zlib-devel, bzip2-devel,
|
||||
BuildRequires: libtool, autoconf, automake, pkgconfig
|
||||
BuildRequires: sqlite-devel
|
||||
BuildRequires: libpq-devel
|
||||
%if %{?fedora}0 < 280
|
||||
BuildRequires: mysql-devel
|
||||
BuildRequires: tcp_wrappers-devel
|
||||
%else
|
||||
BuildRequires: mariadb-connector-c-devel
|
||||
BuildRequires: libxcrypt-devel
|
||||
%endif
|
||||
BuildRequires: openldap-devel
|
||||
BuildRequires: krb5-devel
|
||||
BuildRequires: quota-devel
|
||||
@ -64,31 +59,16 @@ Requires: openssl >= 0.9.7f-4
|
||||
|
||||
# Package includes an initscript service file, needs to require initscripts package
|
||||
Requires(pre): shadow-utils
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
Requires: systemd
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
%else
|
||||
Requires: initscripts
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig initscripts
|
||||
Requires(postun): initscripts
|
||||
%endif
|
||||
|
||||
%if %{?fedora}0 > 150 || %{?rhel}0 >60
|
||||
#clucene in fedora <=15 and rhel<=6 is too old
|
||||
BuildRequires: clucene-core-devel
|
||||
%endif
|
||||
|
||||
%global ssldir %{_sysconfdir}/pki/%{name}
|
||||
|
||||
%if %{?fedora}00%{?rhel} < 6
|
||||
%global _initddir %{_initrddir}
|
||||
BuildRequires: curl-devel expat-devel
|
||||
%else
|
||||
BuildRequires: libcurl-devel expat-devel
|
||||
%endif
|
||||
|
||||
%global restart_flag /run/%{name}/%{name}-restart-after-rpm-install
|
||||
|
||||
@ -144,11 +124,8 @@ sed -i '/DEFAULT_INCLUDES *=/s|$| '"$(pkg-config --cflags libclucene-core)|" src
|
||||
%global _hardened_build 1
|
||||
export CFLAGS="%{__global_cflags} -fno-strict-aliasing -fstack-reuse=none"
|
||||
export LDFLAGS="-Wl,-z,now -Wl,-z,relro %{?__global_ldflags}"
|
||||
# el6 autoconf too old to regen; use packaged files (#1082384)
|
||||
%if %{?fedora}00%{?rhel} > 6
|
||||
mkdir -p m4
|
||||
autoreconf -I . -fiv #required for aarch64 support
|
||||
%endif
|
||||
%configure \
|
||||
INSTALL_DATA="install -c -p -m644" \
|
||||
--docdir=%{_docdir}/%{name} \
|
||||
@ -165,18 +142,11 @@ autoreconf -I . -fiv #required for aarch64 support
|
||||
--with-sqlite \
|
||||
--with-zlib \
|
||||
--with-libcap \
|
||||
%if %{?fedora}0 < 280
|
||||
--with-libwrap \
|
||||
%endif
|
||||
%if %{?fedora}0 > 150 || %{?rhel}0 >60
|
||||
--with-lucene \
|
||||
%endif
|
||||
--with-ssl=openssl \
|
||||
--with-ssldir=%{ssldir} \
|
||||
--with-solr \
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
--with-systemdsystemunitdir=%{_unitdir} \
|
||||
%endif
|
||||
--with-docs
|
||||
|
||||
sed -i 's|/etc/ssl|/etc/pki/dovecot|' doc/mkcert.sh doc/example-config/conf.d/10-ssl.conf
|
||||
@ -216,11 +186,6 @@ mv $RPM_BUILD_ROOT/%{_docdir}/%{name} $RPM_BUILD_ROOT/%{_docdir}/%{name}-pigeonh
|
||||
install -m 644 AUTHORS ChangeLog COPYING COPYING.LGPL INSTALL NEWS README $RPM_BUILD_ROOT/%{_docdir}/%{name}-pigeonhole
|
||||
popd
|
||||
|
||||
|
||||
%if %{?fedora}00%{?rhel} < 6
|
||||
sed -i 's|password-auth|system-auth|' %{SOURCE2}
|
||||
%endif
|
||||
|
||||
install -p -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/dovecot
|
||||
|
||||
#install man pages
|
||||
@ -237,12 +202,7 @@ chmod 600 $RPM_BUILD_ROOT%{ssldir}/certs/dovecot.pem
|
||||
touch $RPM_BUILD_ROOT%{ssldir}/private/dovecot.pem
|
||||
chmod 600 $RPM_BUILD_ROOT%{ssldir}/private/dovecot.pem
|
||||
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
install -p -D -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_tmpfilesdir}/dovecot.conf
|
||||
%else
|
||||
install -p -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/dovecot
|
||||
install -p -D -m 600 %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/dovecot
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/run/dovecot/{login,empty,token-login}
|
||||
|
||||
@ -282,23 +242,14 @@ useradd -r -g dovenull -d /usr/libexec/dovecot -s /sbin/nologin -c "Dovecot's un
|
||||
# do not let dovecot run during upgrade rhbz#134325
|
||||
if [ "$1" = "2" ]; then
|
||||
rm -f %restart_flag
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
/bin/systemctl is-active %{name}.service >/dev/null 2>&1 && touch %restart_flag ||:
|
||||
/bin/systemctl stop %{name}.service >/dev/null 2>&1
|
||||
%else
|
||||
/sbin/service %{name} status >/dev/null 2>&1 && touch %restart_flag ||:
|
||||
/sbin/service %{name} stop >/dev/null 2>&1
|
||||
%endif
|
||||
fi
|
||||
|
||||
%post
|
||||
if [ $1 -eq 1 ]
|
||||
then
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
%systemd_post dovecot.service
|
||||
%else
|
||||
/sbin/chkconfig --add %{name}
|
||||
%endif
|
||||
fi
|
||||
|
||||
install -d -m 0755 -g dovecot -d /run/dovecot
|
||||
@ -309,27 +260,16 @@ install -d -m 0750 -g dovenull -d /run/dovecot/token-login
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
/bin/systemctl disable dovecot.service dovecot.socket >/dev/null 2>&1 || :
|
||||
/bin/systemctl stop dovecot.service dovecot.socket >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/service %{name} stop > /dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}
|
||||
%endif
|
||||
rm -rf /run/dovecot
|
||||
fi
|
||||
|
||||
%postun
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
%endif
|
||||
|
||||
if [ "$1" -ge "1" -a -e %restart_flag ]; then
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
/bin/systemctl start dovecot.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/service %{name} start >/dev/null 2>&1 || :
|
||||
%endif
|
||||
rm -f %restart_flag
|
||||
fi
|
||||
|
||||
@ -337,11 +277,7 @@ fi
|
||||
# dovecot should be started again in %%postun, but it's not executed on reinstall
|
||||
# if it was already started, restart_flag won't be here, so it's ok to test it again
|
||||
if [ -e %restart_flag ]; then
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
/bin/systemctl start dovecot.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/service %{name} start >/dev/null 2>&1 || :
|
||||
%endif
|
||||
rm -f %restart_flag
|
||||
fi
|
||||
|
||||
@ -360,15 +296,10 @@ make check
|
||||
%{_bindir}/dovecot-sysreport
|
||||
|
||||
|
||||
%if %{?fedora}0 > 140 || %{?rhel}0 > 60
|
||||
%_tmpfilesdir/dovecot.conf
|
||||
%{_unitdir}/dovecot.service
|
||||
%{_unitdir}/dovecot-init.service
|
||||
%{_unitdir}/dovecot.socket
|
||||
%else
|
||||
%{_initddir}/dovecot
|
||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/dovecot
|
||||
%endif
|
||||
|
||||
%dir %{_sysconfdir}/dovecot
|
||||
%dir %{_sysconfdir}/dovecot/conf.d
|
||||
|
Loading…
Reference in New Issue
Block a user