From 58cdd8cb3764cb86217b1e358b14677d8a13865a Mon Sep 17 00:00:00 2001 From: Chris Caron Date: May 23 2017 12:15:49 +0000 Subject: Update spec file so it can be built on el6, el7 and Fedora --- diff --git a/awstats.spec b/awstats.spec index 93521ce..cc28c48 100644 --- a/awstats.spec +++ b/awstats.spec @@ -8,23 +8,34 @@ URL: http://awstats.sourceforge.net Source0: http://downloads.sourceforge.net/project/awstats/AWStats/%{version}/awstats-%{version}.tar.gz Source1: %{name}.cron Patch0: awstats-awredir.pl-sanitize-parameters.patch + +%if 0%{?rhel} == 7 || 0%{?fedora} # fix configuration for httpd 2.4 (#871366) Patch1: awstats-7.0-httpd-2.4.patch +%endif + +# distribution specific definitions +%define use_systemd (0%{?fedora} || 0%{?rhel} >= 7) BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -# For systemd.macros BuildRequires: coreutils BuildRequires: findutils BuildRequires: perl BuildRequires: perl-generators -BuildRequires: systemd BuildRequires: recode Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Requires: perl-Net-IP, perl-Net-DNS, perl-Geo-IP Requires: crontabs Requires(post): perl + +%if %use_systemd +# For systemd.macros +BuildRequires: systemd Requires(postun): systemd +%else +Requires(postun): /sbin/service +%endif ## SELinux policy is now included upstream Obsoletes: awstats-selinux < 6.8-1 @@ -51,7 +62,9 @@ http://localhost/awstats/awstats.pl %prep %setup -q %patch0 -p 1 +%if 0%{?rhel} == 7 || 0%{?fedora} %patch1 -p 1 +%endif # Fix style sheets. perl -pi -e 's,/icon,/awstatsicons,g' wwwroot/css/* @@ -135,7 +148,13 @@ if [ $1 -eq 1 ]; then fi %postun +%if %use_systemd %systemd_postun_with_restart httpd.service +%else +if [ $1 -ne 0 ]; then + /sbin/service httpd condrestart >/dev/null 2>&1 +fi +%endif %files