From 0e4e237d289397a59780ee02bad2953b9dd55e6e Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Sat, 5 Jul 2014 11:44:03 +0200 Subject: [PATCH 01/16] Use modern GPL license tag refs #5818 --- icinga2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icinga2.spec b/icinga2.spec index 6fa099bc3..bd65d9043 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -64,7 +64,7 @@ Summary: Network monitoring application Name: icinga2 Version: 2.0.1 Release: %{revision}%{?dist} -License: GPLv2+ +License: GPL-2.0+ Group: Applications/System Source: %{name}-%{version}.tar.gz URL: http://www.icinga.org/ From c3a925140713fa78fb13188eb31352bb04bdd6ac Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 13 Jun 2014 11:51:22 +0200 Subject: [PATCH 02/16] Logrotate.conf doesn't need execution rights refs #5818 --- icinga2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icinga2.spec b/icinga2.spec index bd65d9043..23d0e6929 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -498,7 +498,7 @@ exit 0 %files common %defattr(-,root,root,-) %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog tools/syntax -%config(noreplace) %attr(755,-,-) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp From a090eb0ba36c28ebfff06870f318e3e9e5d225ab Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 12:01:22 +0200 Subject: [PATCH 03/16] Add log directory to icinga2-common RPMLint complains if logrotate is used without including the log directory in the package. refs #5818 --- icinga2.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/icinga2.spec b/icinga2.spec index 23d0e6929..e2a2619cf 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -498,6 +498,7 @@ exit 0 %files common %defattr(-,root,root,-) %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog tools/syntax +%attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name} %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata From f51a98e8a702cc11294021921fe30a036660f57e Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Thu, 3 Jul 2014 18:00:27 +0200 Subject: [PATCH 04/16] Don't copy INSTALL documentation to system docs The INSTALL documentation is not relevant after installation, especially if packages are used. This does prevent a rpmlint warning. refs #5818 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af48befee..2d0ec88cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,7 +127,7 @@ endif() configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ESCAPE_QUOTES) install( - FILES README COPYING COPYING.Exceptions AUTHORS ChangeLog INSTALL NEWS + FILES README COPYING COPYING.Exceptions AUTHORS ChangeLog NEWS DESTINATION ${CMAKE_INSTALL_DOCDIR} ) From 24363e441cf8b11ad2136b803e71741b8d11b147 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 11:18:31 +0200 Subject: [PATCH 05/16] Recommend logrotate in icinga2-common Since we install a logrotate configuration file it does make sense to at least recommend the installation of logrotate. This addition is restricted to SUSE distributions since "Recommends" is not supported elsewhere. refs #5818 --- icinga2.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/icinga2.spec b/icinga2.spec index e2a2619cf..0eb30ebf0 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -158,6 +158,9 @@ Group: Applications/System Requires(pre): shadow-utils Requires(post): shadow-utils %endif +%if "%{_vendor}" == "suse" +Recommends: logrotate +%endif %description common Provides common directories, uid and gid among Icinga 2 related From 0d72f54018a40e8aa014b9b83ffbc35e86d9065a Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 11:19:45 +0200 Subject: [PATCH 06/16] Description should be longer than the summary This fixes a rpmlint warning. refs #5818 --- icinga2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icinga2.spec b/icinga2.spec index 0eb30ebf0..206e8c459 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -173,7 +173,7 @@ Group: Applications/System Requires: %{name} = %{version}-%{release} %description doc -Documentation for Icinga 2 +Provides documentation for Icinga 2. %package ido-mysql From 5a98379eb8a6c9f255cfabe7a6c8397ef19dab74 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 11:23:39 +0200 Subject: [PATCH 07/16] Remove .gitignore files from package This commit can be reversed as soon as there are upgrade files in the schema upgrade directories. refs #5818 --- icinga2.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/icinga2.spec b/icinga2.spec index 206e8c459..db7f913dc 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -273,6 +273,8 @@ cmake $CMAKE_OPTS . make %{?_smp_mflags} +rm -f components/db_ido_*sql/schema/upgrade/.gitignore + %install [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot} make install \ From 1fcf746108e4d6e3a0c57189ac6f747e0715dde1 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 11:49:51 +0200 Subject: [PATCH 08/16] Activate systemd on SUSE distributions refs #5818 --- icinga2.spec | 51 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index db7f913dc..e5e23918e 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -36,10 +36,11 @@ %endif %if "%{_vendor}" == "suse" -# opensuse 13 %if 0%{?suse_version} >= 1310 +%define use_systemd 1 %define opensuse_boost_version 1_53_0 %else +%define use_systemd 0 %define opensuse_boost_version 1_49_0 %endif %define sles_boost_version 1_54_0 @@ -47,7 +48,6 @@ %define apacheconfdir %{_sysconfdir}/apache2/conf.d %define apacheuser wwwrun %define apachegroup www -%define use_systemd 0 %endif %define icinga_user icinga @@ -288,6 +288,18 @@ install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apachecon # remove features-enabled symlinks rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf +# enable suse rc links +%if "%{_vendor}" == "suse" +%if 0%{?use_systemd} + ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name} +%else + ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}" +%endif +mkdir -p "%{buildroot}%{_localstatedir}/adm/fillup-templates/" +mv "%{buildroot}%{_sysconfdir}/sysconfig/%{name}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}" +%endif + + %clean [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot} @@ -297,12 +309,26 @@ getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacm getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user} exit 0 + +%if "%{_vendor}" == "suse" +%if 0%{?use_systemd} +%pre bin + %service_add_pre %{name}.service +%endif +%endif + + # all restart/feature actions belong to icinga2-bin %post bin # suse %if 0%{?suse_version} +%if 0%{?use_systemd} +%fillup_only %{name} +%service_add_post %{name}.service +%else %fillup_and_insserv %{name} +%endif # initial installation, enable default features %{_sbindir}/icinga2-enable-feature checker notification mainlog @@ -332,9 +358,12 @@ exit 0 %postun bin # suse %if 0%{?suse_version} - -%restart_on_update %{name} -%insserv_cleanup +%if 0%{?using_systemd} + %service_del_postun %{name}.service +%else + %restart_on_update %{name} + %insserv_cleanup +%endif if [ "$1" = "0" ]; then # deinstallation of the package - remove enabled features @@ -367,6 +396,11 @@ exit 0 # suse %if 0%{?suse_version} +%if 0%{?use_systemd} + %service_del_preun %{name}.service +%else + %stop_on_removal %{name} +%endif if [ "$1" = "0" ]; then %stop_on_removal %{name} fi @@ -453,6 +487,12 @@ exit 0 %else %attr(755,-,-) %{_sysconfdir}/init.d/%{name} %endif +%if "%{_vendor}" == "suse" +%{_sbindir}/rc%{name} +%{_localstatedir}/adm/fillup-templates/sysconfig.%{name} +%else +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%endif %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d/hosts @@ -470,7 +510,6 @@ exit 0 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/* %config(noreplace) %{_sysconfdir}/%{name}/scripts/* -%config(noreplace) %{_sysconfdir}/sysconfig/%{name} %{_sbindir}/%{name} %{_bindir}/%{name}-build-ca %{_bindir}/%{name}-build-key From e7d3500ca7230bfa88a3e0d82d4ff89c988df173 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 13:00:19 +0200 Subject: [PATCH 09/16] Reduce redunancies in spec file Remove redundant differences between SUSE and RHEL distributions. refs #5818 --- icinga2.spec | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index e5e23918e..2668e0a61 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -365,13 +365,6 @@ exit 0 %insserv_cleanup %endif -if [ "$1" = "0" ]; then - # deinstallation of the package - remove enabled features - rm -rf %{_sysconfdir}/%{name}/features-enabled -fi - -exit 0 - %else # rhel @@ -383,14 +376,15 @@ if [ "$1" -ge "1" ]; then fi %endif +%endif +# suse / rhel + if [ "$1" = "0" ]; then # deinstallation of the package - remove enabled features rm -rf %{_sysconfdir}/%{name}/features-enabled fi exit 0 -%endif -# suse / rhel %preun bin # suse @@ -401,9 +395,6 @@ exit 0 %else %stop_on_removal %{name} %endif -if [ "$1" = "0" ]; then - %stop_on_removal %{name} -fi exit 0 From 1618e15757c51f50f3eca12e4a21227cef9101e3 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 13:13:54 +0200 Subject: [PATCH 10/16] Remove redundant mysql requirement The mysql dependencies are recognized automatically during building. refs #5818 --- icinga2.spec | 5 ----- 1 file changed, 5 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index 2668e0a61..6f337bd17 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -181,11 +181,6 @@ Summary: IDO MySQL database backend for Icinga 2 Group: Applications/System %if "%{_vendor}" == "suse" BuildRequires: libmysqlclient-devel -%if 0%{?suse_version} >= 1210 -Requires: libmysqlclient18 -%else -Requires: libmysqlclient15 -%endif %endif %if "%{_vendor}" == "redhat" # el5 only provides mysql package From f57884ee2ad96bd32c97ac39b4d39dab5ce181a8 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 13:58:09 +0200 Subject: [PATCH 11/16] Remove obsolete pgsqllib require on SUSE distributions refs #5818 --- icinga2.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index 6f337bd17..891007975 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -203,9 +203,6 @@ IDOUtils schema >= 1.10 %package ido-pgsql Summary: IDO PostgreSQL database backend for Icinga 2 Group: Applications/System -%if "%{_vendor}" == "suse" -BuildRequires: postgresql-libs -%endif BuildRequires: postgresql-devel Requires: postgresql-libs Requires: %{name} = %{version}-%{release} From c8db76ad6ed0fd7529a7845ef31116562f5cc2c1 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Thu, 3 Jul 2014 17:59:02 +0200 Subject: [PATCH 12/16] Use root as default user and group to prevent issues refs #5818 --- icinga2.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index 891007975..59a47580c 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -466,9 +466,9 @@ exit 0 %defattr(-,root,root,-) %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog %if 0%{?use_systemd} -%attr(644,-,0) %{_unitdir}/%{name}.service +%attr(644,root,root) %{_unitdir}/%{name}.service %else -%attr(755,-,-) %{_sysconfdir}/init.d/%{name} +%attr(755,root,root) %{_sysconfdir}/init.d/%{name} %endif %if "%{_vendor}" == "suse" %{_sbindir}/rc%{name} From 074521b69cbd17553b61c95c7c6e2fd6583c47e5 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 4 Jul 2014 13:29:40 +0200 Subject: [PATCH 13/16] Use permission verfication scripts on SUSE distributions refs #5818 --- icinga2.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/icinga2.spec b/icinga2.spec index 59a47580c..774f4489a 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -81,6 +81,9 @@ Meta package for Icinga 2 Core, DB IDO and Web. Summary: Icinga 2 binaries and libraries Group: Applications/System +%if "%{_vendor}" == "suse" +PreReq: permissions +%endif BuildRequires: openssl-devel BuildRequires: gcc-c++ BuildRequires: libstdc++-devel @@ -301,6 +304,11 @@ getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacm getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user} exit 0 +%if "%{_vendor}" == "suse" +%verifyscript bin +%verify_permissions -e /var/run/icinga2/cmd +%endif + %if "%{_vendor}" == "suse" %if 0%{?use_systemd} @@ -314,7 +322,9 @@ exit 0 %post bin # suse %if 0%{?suse_version} - +%if 0%{?suse_version} >= 1310 +%set_permissions /var/run/icinga2/cmd +%endif %if 0%{?use_systemd} %fillup_only %{name} %service_add_post %{name}.service From 98aaff4e01d861d07fef8b54522384e122ccc921 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Sat, 5 Jul 2014 12:34:31 +0200 Subject: [PATCH 14/16] Prevent empty icinga2 package by adding COPYING Empty packages are not allowed on SLES11 and also produce a warning in newer openSUSE releases. So we just work around the issue by adding the COPYING file. refs #5818 --- icinga2.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/icinga2.spec b/icinga2.spec index 774f4489a..74f7e16dc 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -471,6 +471,8 @@ fi exit 0 %files +%defattr(-,root,root,-) +%doc COPYING %files bin %defattr(-,root,root,-) From 8bbbab57ab98d743929bec2607e39cc3ba222fc7 Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Fri, 11 Jul 2014 09:11:34 +0200 Subject: [PATCH 15/16] Use Github url as tarball source This allows the automatic download of new versions. refs #5818 --- icinga2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icinga2.spec b/icinga2.spec index 74f7e16dc..af04f1906 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -66,7 +66,7 @@ Version: 2.0.1 Release: %{revision}%{?dist} License: GPL-2.0+ Group: Applications/System -Source: %{name}-%{version}.tar.gz +Source: https://github.com/Icinga/%{name}/archive/v%{version}.tar.gz URL: http://www.icinga.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build From 2f594f76744930dd7542a73e30a2282ee8b71f6d Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 30 Jul 2014 13:41:23 +0200 Subject: [PATCH 16/16] Remove redundant RPM Requires refs #5818 --- icinga2.spec | 74 +++++----------------------------------------------- 1 file changed, 7 insertions(+), 67 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index af04f1906..336218719 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -20,9 +20,6 @@ %define revision 1 %if "%{_vendor}" == "redhat" -%define el5_boost_version 141 -%define el5_boost_libs %{_libdir}/boost%{el5_boost_version} -%define el5_boost_includes /usr/include/boost%{el5_boost_version} %define apachename httpd %define apacheconfdir %{_sysconfdir}/httpd/conf.d %define apacheuser apache @@ -36,18 +33,15 @@ %endif %if "%{_vendor}" == "suse" -%if 0%{?suse_version} >= 1310 -%define use_systemd 1 -%define opensuse_boost_version 1_53_0 -%else -%define use_systemd 0 -%define opensuse_boost_version 1_49_0 -%endif -%define sles_boost_version 1_54_0 %define apachename apache2 %define apacheconfdir %{_sysconfdir}/apache2/conf.d %define apacheuser wwwrun %define apachegroup www +%if 0%{?suse_version} >= 1310 +%define use_systemd 1 +%else +%define use_systemd 0 +%endif %endif %define icinga_user icinga @@ -92,56 +86,12 @@ BuildRequires: flex >= 2.5.35 BuildRequires: bison BuildRequires: make -# redhat -%if "%{_vendor}" == "redhat" -%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" +%if "%{_vendor}" == "redhat" && (0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5") # el5 requires EPEL -BuildRequires: boost%{el5_boost_version}-devel -BuildRequires: boost%{el5_boost_version} -Requires: boost%{el5_boost_version}-program-options -Requires: boost%{el5_boost_version}-system -Requires: boost%{el5_boost_version}-test -Requires: boost%{el5_boost_version}-thread -Requires: boost%{el5_boost_version}-regex +BuildRequires: boost141-devel %else BuildRequires: boost-devel >= 1.41 -Requires: boost-program-options >= 1.41 -Requires: boost-system >= 1.41 -Requires: boost-test >= 1.41 -Requires: boost-thread >= 1.41 -Requires: boost-regex >= 1.41 %endif -%endif -#redhat - -# suse -%if "%{_vendor}" == "suse" -# sles -# note: sles_version macro is not set in SLES11 anymore -# note: sles service packs are not under version control -%if 0%{?suse_version} == 1110 -BuildRequires: gcc-fortran -BuildRequires: libgfortran43 -BuildRequires: boost-license%{sles_boost_version} -BuildRequires: boost-devel >= 1.41 -Requires: boost-license%{sles_boost_version} -Requires: libboost_program_options%{sles_boost_version} -Requires: libboost_system%{sles_boost_version} -Requires: libboost_test%{sles_boost_version} -Requires: libboost_thread%{sles_boost_version} -Requires: libboost_regex%{sles_boost_version} -%endif -# opensuse -%if 0%{?suse_version} >= 1210 -BuildRequires: boost-devel >= 1.41 -Requires: libboost_program_options%{opensuse_boost_version} -Requires: libboost_system%{opensuse_boost_version} -Requires: libboost_test%{opensuse_boost_version} -Requires: libboost_thread%{opensuse_boost_version} -Requires: libboost_regex%{opensuse_boost_version} -%endif -%endif -# suse %if 0%{?use_systemd} BuildRequires: systemd @@ -185,17 +135,8 @@ Group: Applications/System %if "%{_vendor}" == "suse" BuildRequires: libmysqlclient-devel %endif -%if "%{_vendor}" == "redhat" -# el5 only provides mysql package -%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" -BuildRequires: mysql -%else -BuildRequires: mysql-libs -BuildRequires: mysql -%endif BuildRequires: mysql-devel Requires: mysql -%endif Requires: %{name} = %{version}-%{release} %description ido-mysql @@ -207,7 +148,6 @@ IDOUtils schema >= 1.10 Summary: IDO PostgreSQL database backend for Icinga 2 Group: Applications/System BuildRequires: postgresql-devel -Requires: postgresql-libs Requires: %{name} = %{version}-%{release} %description ido-pgsql