Add cmake constant for PluginDir

fixes #6548
This commit is contained in:
Gunnar Beutner 2014-07-16 09:03:51 +02:00
parent fcdd5d3ea5
commit e6dc8c21a1
6 changed files with 17 additions and 12 deletions

View 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)

View File

@ -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

3
debian/rules vendored
View File

@ -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

View File

@ -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)

View 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.

View 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