RPM: Fix builds on Amazon Linux

This also disables the deprecated classicui-config packages
on Amazon Linux.

The major fix is to disable Systemd just like CentOS6 provides.
This commit is contained in:
Michael Friedrich 2017-05-29 20:23:52 +02:00
parent 3ad1527024
commit 29a9c4564f
1 changed files with 28 additions and 8 deletions

View File

@ -31,7 +31,7 @@
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
%define apacheuser apache
%define apachegroup apache
%if 0%{?el5}%{?el6}
%if 0%{?el5}%{?el6}%{?amzn}
%define use_systemd 0
%if %(uname -m) != "x86_64"
%define march_flag -march=i686
@ -148,10 +148,10 @@ Provides binaries for Icinga 2 Core.
%package common
Summary: Common Icinga 2 configuration
Group: Applications/System
%if "%{_vendor}" == "redhat"
Requires(pre): shadow-utils
Requires(post): shadow-utils
%endif
%{?amzn:Requires(pre): shadow-utils}
%{?fedora:Requires(pre): shadow-utils}
%{?rhel:Requires(pre): shadow-utils}
%{?suse_version:Requires(pre): pwdutils}
%if "%{_vendor}" == "suse"
Recommends: logrotate
%endif
@ -213,6 +213,8 @@ Requires: %{name} = %{version}-%{release}
Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
IDOUtils schema >= 1.12
# DEPRECATED, disable builds on Amazon
%if !(0%{?amzn})
# DEPRECATED
%package classicui-config
@ -232,6 +234,9 @@ Conflicts: icinga-gui-config
Icinga 1.x Classic UI Standalone configuration with locations
for Icinga 2.
# DEPRECATED, disable builds on Amazon
%endif
%if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
%global selinux_variants mls targeted
%{!?_selinux_policy_version: %global _selinux_policy_version %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp 2>/dev/null)}
@ -367,12 +372,17 @@ cd -
make install \
DESTDIR="%{buildroot}"
# DEPRECATED
# DEPRECATED, disable builds on Amazon
%if !(0%{?amzn})
# install classicui config
install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
# DEPRECATED, disable builds on Amazon
%endif
# remove features-enabled symlinks
rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
@ -600,7 +610,9 @@ fi
exit 0
# DEPRECATED
# DEPRECATED, disable builds on Amazon
%if !(0%{?amzn})
%post classicui-config
if [ ${1:-0} -eq 1 ]
then
@ -625,6 +637,9 @@ fi
exit 0
# DEPRECATED, disable builds on Amazon
%endif
%if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
%post selinux
for selinuxvariant in %{selinux_variants}
@ -744,7 +759,9 @@ fi
%{_libdir}/%{name}/libdb_ido_pgsql*
%{_datadir}/icinga2-ido-pgsql
# DEPRECATED
# DEPRECATED, disable builds on Amazon
%if !(0%{?amzn})
%files classicui-config
%defattr(-,root,root,-)
%attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
@ -752,6 +769,9 @@ fi
%config(noreplace) %{apacheconfdir}/icinga.conf
%config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
# DEPRECATED, disable builds on Amazon
%endif
%if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
%files selinux
%defattr(-,root,root,0755)