From 52ce2e8479eb60f8b0afa98a7ae3e5e5e68533b4 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Fri, 13 Mar 2015 12:12:38 +0200 Subject: [PATCH] RPM: Clean up and unbreak future upgrades on Fedora/CentOS7 --- centos/rspamd.spec | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/centos/rspamd.spec b/centos/rspamd.spec index 52ead62af..80ded2938 100644 --- a/centos/rspamd.spec +++ b/centos/rspamd.spec @@ -6,13 +6,6 @@ %define rspamd_pluginsdir %{_datadir}/rspamd %define rspamd_wwwdir %{_datadir}/rspamd/www -%if 0%{?suse_version} -%define __cmake cmake -%define __install install -%define __make make -%define __chown chown -%endif - Name: rspamd Version: 0.8.2 Release: 1 @@ -49,14 +42,11 @@ Requires: logrotate Requires(post): chkconfig Requires(preun): chkconfig, initscripts Requires(postun): initscripts -%endif - -Source0: https://rspamd.com/downloads/%{name}-%{version}.tar.xz -%if 0%{?el6} Source1: %{name}.init Source2: %{name}.logrotate %endif +Source0: https://rspamd.com/downloads/%{name}-%{version}.tar.xz Patch0: %{name}.service.patch %description @@ -77,8 +67,10 @@ lua. -DMANDIR=%{_mandir} \ -DDBDIR=%{_localstatedir}/lib/rspamd \ -DRUNDIR=%{_localstatedir}/run/rspamd \ -%if %{undefined suse_version} && %{undefined fedora} && 0%{?rhel} < 7 +%if 0%{?el6} -DWANT_SYSTEMD_UNITS=OFF \ +%else + -DSYSTEMDDIR=%{_unitdir} \ %endif -DLOGDIR=%{_localstatedir}/log/rspamd \ -DEXAMPLESDIR=%{_datadir}/examples/rspamd \ @@ -118,12 +110,12 @@ rm -rf %{buildroot} %post #to allow easy upgrade from 0.8.1 -chown -R %{rspamd_user}:%{rspamd_group} %{rspamd_home} +%{__chown} -R %{rspamd_user}:%{rspamd_group} %{rspamd_home} %if 0%{?suse_version} %service_add_post %{name}.service %service_add_post %{name}.socket %endif -%if 0%{?fedora} || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?el7} %systemd_post %{name}.service %systemd_post %{name}.socket %endif @@ -136,11 +128,11 @@ chown -R %{rspamd_user}:%{rspamd_group} %{rspamd_home} %service_del_preun %{name}.service %service_del_preun %{name}.socket %endif -%if 0%{?fedora} || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?el7} %systemd_preun %{name}.service %systemd_preun %{name}.socket %endif -%if %{undefined suse_version} && %{undefined fedora} && 0%{?rhel} < 7 +%if 0%{?el6} if [ $1 = 0 ]; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} @@ -152,11 +144,11 @@ fi %service_del_postun %{name}.service %service_del_postun %{name}.socket %endif -%if 0%{?fedora} || 0%{?rhel} >= 7 -%systemd_postun %{name}.service +%if 0%{?fedora} || 0%{?el7} +%systemd_postun_with_restart %{name}.service %systemd_postun %{name}.socket %endif -%if %{undefined suse_version} && %{undefined fedora} && 0%{?rhel} < 7 +%if 0%{?el6} if [ $1 -ge 1 ]; then /sbin/service %{name} condrestart > /dev/null 2>&1 || : fi @@ -165,7 +157,7 @@ fi %files %defattr(-,root,root,-) -%if 0%{?suse_version} || 0%{?fedora} || 0%{?rhel} >= 7 +%if 0%{?suse_version} || 0%{?fedora} || 0%{?el7} %{_unitdir}/%{name}.service %{_unitdir}/%{name}.socket %endif -- 2.39.5