From 933e2480fc979b9d24d3e9c01e41861cbfee3a1f Mon Sep 17 00:00:00 2001 From: Gerd von Egidy Date: Tue, 24 Jun 2014 03:02:00 +0200 Subject: [PATCH] add new cmake option INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT requested for Gentoo packaging fixes #6498 Signed-off-by: Gunnar Beutner --- INSTALL | 4 ++++ etc/initsystem/CMakeLists.txt | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/INSTALL b/INSTALL index 5329fb1cb..99e878953 100644 --- a/INSTALL +++ b/INSTALL @@ -131,6 +131,10 @@ variables are supported: defaults to CMAKE_INSTALL_PREFIX/etc/sysconfig/icinga2 - CMAKE_INSTALL_LOCALSTATEDIR: The state directory; defaults to CMAKE_INSTALL_PREFIX/var - USE_SYSTEMD=ON|OFF: Use systemd or a classic SysV initscript; defaults to OFF +- INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=ON|OFF Force install both the systemd service definition file + and the SysV initscript in parallel, regardless of how USE_SYSTEMD is set. + Only use this for special packaging purposes and if you know what you are doing. + Defaults to OFF ### Building Icinga 2 RPMs diff --git a/etc/initsystem/CMakeLists.txt b/etc/initsystem/CMakeLists.txt index f29c6dc14..b7810e06d 100644 --- a/etc/initsystem/CMakeLists.txt +++ b/etc/initsystem/CMakeLists.txt @@ -39,15 +39,20 @@ if(NOT WIN32) option (USE_SYSTEMD "Configure icinga as native systemd service instead of a SysV initscript" OFF) - if (NOT USE_SYSTEMD) - + # required for packaging on Gentoo, see Bug #6498 + option (INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT + "Force install both the systemd service definition file and the SysV initscript in parallel, regardless of how USE_SYSTEMD is set. Only use this for special packaging purposes and if you know what you are doing" OFF) + + if (NOT USE_SYSTEMD OR INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT) configure_file(icinga2.init.d.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2 DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/init.d PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) - else() + endif() + + if (USE_SYSTEMD OR INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT) configure_file(icinga2.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service @ONLY) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service