]> granicus.if.org Git - icinga2/commitdiff
Add cmake constant for PluginDir
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 16 Jul 2014 07:03:51 +0000 (09:03 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 16 Jul 2014 07:03:51 +0000 (09:03 +0200)
fixes #6548

CMakeLists.txt
INSTALL
debian/rules
etc/CMakeLists.txt
etc/icinga2/constants.conf.cmake [moved from etc/icinga2/constants.conf with 90% similarity]
icinga2.spec

index 58963f55ae3a229aa1b193b2faeb96605236bb63..24e3778fb51b7065a6e44627981e3d6bf982de4e 100644 (file)
@@ -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 893f7c3e2d6764e74b919c0f4e510543ba093734..06f530529759a515eb84a1f83a8d2d957c770d73 100644 (file)
--- 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
index aee72e022b7eb3f68c1aa54a90b6e923b0315dea..d7a5d84da5844b787fd792b721bb66b24b2fbae2 100755 (executable)
@@ -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
index 8aba39d1a57bc08d3ed53479724ef282fad9bd85..ef94110264c2caf0fdd5bc29c801c768f412c1e1 100644 (file)
 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)
similarity index 90%
rename from etc/icinga2/constants.conf
rename to etc/icinga2/constants.conf.cmake
index f6fc32303b45d43adbb1267cc6972c098f9dbdb8..cee504b508c3e95aa3397ce4e2a510248b32a585 100644 (file)
@@ -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.
index dc20b178909254a68d7004b0dcb162e2e83f326a..922434937111ef33228a13b76c427dd0200542f1 100644 (file)
@@ -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