From e6dc8c21a1e5482fce2ff2758cd7633138426b2c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 16 Jul 2014 09:03:51 +0200 Subject: [PATCH] Add cmake constant for PluginDir fixes #6548 --- CMakeLists.txt | 1 + INSTALL | 3 ++- debian/rules | 3 ++- etc/CMakeLists.txt | 3 ++- .../{constants.conf => constants.conf.cmake} | 2 +- icinga2.spec | 17 +++++++++-------- 6 files changed, 17 insertions(+), 12 deletions(-) rename etc/icinga2/{constants.conf => constants.conf.cmake} (90%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58963f55a..24e3778fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ set(ICINGA2_USER "icinga" CACHE STRING "Icinga 2 user") set(ICINGA2_GROUP "icinga" CACHE STRING "Icinga 2 group") set(ICINGA2_COMMAND_USER "icinga" CACHE STRING "Icinga 2 command user") set(ICINGA2_COMMAND_GROUP "icingacmd" CACHE STRING "Icinga 2 command group") +set(ICINGA2_PLUGIN_PATH "/usr/lib/nagios/plugins" CACHE STRING "Path for the check plugins") set(ICINGA2_GIT_VERSION_INFO ON CACHE BOOL "Whether to use git describe") file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL) diff --git a/INSTALL b/INSTALL index 893f7c3e2..06f530529 100644 --- a/INSTALL +++ b/INSTALL @@ -125,7 +125,8 @@ variables are supported: - ICINGA2_GROUP: The group Icinga 2 should run as; defaults to "icinga" - ICINGA2_COMMAND_USER: The command user Icinga 2 should use; defaults to "icinga" - ICINGA2_GIT_VERSION_INFO: Whether to use Git to determine the version number; defaults to "ON" -- ICINGA2_COMMAND_GROUP: The command group Icinga 2 should use; default to "icingacmd" +- ICINGA2_COMMAND_GROUP: The command group Icinga 2 should use; defaults to "icingacmd" +- ICINGA2_PLUGIN_PATH: The path for the Monitoring Plugins project binaries; defaults to "/usr/lib/nagios/plugins" - CMAKE_INSTALL_SYSCONFDIR: The configuration directory; defaults to CMAKE_INSTALL_PREFIX/etc - ICINGA2_SYSCONFIGFILE: Where to put the config file the initscript/systemd pulls it's dirs from; defaults to CMAKE_INSTALL_PREFIX/etc/sysconfig/icinga2 diff --git a/debian/rules b/debian/rules index aee72e022..d7a5d84da 100755 --- a/debian/rules +++ b/debian/rules @@ -25,7 +25,8 @@ override_dh_auto_configure: -DICINGA2_USER=nagios \ -DICINGA2_GROUP=nagios \ -DICINGA2_COMMAND_USER=nagios \ - -DICINGA2_COMMAND_GROUP=www-data + -DICINGA2_COMMAND_GROUP=www-data \ + -DICINGA2_PLUGIN_PATH=/usr/lib/nagios/plugins override_dh_auto_install: dh_auto_install diff --git a/etc/CMakeLists.txt b/etc/CMakeLists.txt index 8aba39d1a..ef9411026 100644 --- a/etc/CMakeLists.txt +++ b/etc/CMakeLists.txt @@ -18,10 +18,11 @@ include(InstallConfig) configure_file(icinga/icinga-classic-apache.conf.cmake ${CMAKE_CURRENT_BINARY_DIR}/icinga/icinga-classic-apache.conf @ONLY) +configure_file(icinga2/constants.conf.cmake ${CMAKE_CURRENT_BINARY_DIR}/icinga2/constants.conf @ONLY) configure_file(logrotate.d/icinga2.cmake ${CMAKE_CURRENT_BINARY_DIR}/logrotate.d/icinga2 @ONLY) install_if_not_exists(icinga2/icinga2.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2) -install_if_not_exists(icinga2/constants.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2) +install_if_not_exists(${CMAKE_CURRENT_BINARY_DIR}/icinga2/constants.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2) install_if_not_exists(icinga2/zones.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2) install_if_not_exists(icinga2/conf.d/commands.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) install_if_not_exists(icinga2/conf.d/downtimes.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d) diff --git a/etc/icinga2/constants.conf b/etc/icinga2/constants.conf.cmake similarity index 90% rename from etc/icinga2/constants.conf rename to etc/icinga2/constants.conf.cmake index f6fc32303..cee504b50 100644 --- a/etc/icinga2/constants.conf +++ b/etc/icinga2/constants.conf.cmake @@ -4,7 +4,7 @@ */ /* The directory which contains the plugins from the Monitoring Plugins project. */ -const PluginDir = "/usr/lib/nagios/plugins" +const PluginDir = "@ICINGA2_PLUGIN_PATH@" /* Our local instance name. By default this is the server's hostname as returned by `hostname --fqdn`. * This should be the common name from the API certificate. diff --git a/icinga2.spec b/icinga2.spec index dc20b1789..922434937 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -237,12 +237,12 @@ for Icinga 2. %build CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_SYSCONFDIR=/etc \ - -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ + -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DICINGA2_USER=%{icinga_user} \ -DICINGA2_GROUP=%{icinga_group} \ - -DICINGA2_COMMAND_USER=%{icinga_user} \ - -DICINGA2_COMMAND_GROUP=%{icingacmd_group}" + -DICINGA2_COMMAND_USER=%{icinga_user} \ + -DICINGA2_COMMAND_GROUP=%{icingacmd_group}" %if "%{_vendor}" == "redhat" %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" # Boost_VERSION 1.41.0 vs 101400 - disable build tests @@ -256,6 +256,12 @@ CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \ %endif %endif +%if "%{_vendor}" != "suse" +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGIN_PATH=%{_libdir}/nagios/plugins" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGIN_PATH=%{_prefix}/lib/nagios/plugins" +%endif + %if 0%{?use_systemd} CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON" %endif @@ -274,11 +280,6 @@ install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassi 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 -# fix plugin path on x64 -%if "%{_vendor}" != "suse" -sed -i 's@PluginDir = .*@PluginDir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/constants.conf -%endif - # remove features-enabled symlinks rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf