Separate CMakeLists.txt for etc/initsystem.

Refs #6491
This commit is contained in:
Gerd von Egidy 2014-06-16 01:55:50 +02:00
parent ef2ffd8534
commit 3ac3c91499
2 changed files with 59 additions and 41 deletions

View File

@ -75,46 +75,6 @@ else()
)
endif()
if(NOT WIN32)
if(NOT DEFINED ICINGA2_SYSCONFIGFILE)
set(ICINGA2_SYSCONFIGFILE "${CMAKE_INSTALL_SYSCONFDIR}/sysconfig/icinga2" CACHE PATH "where to store configuation for the init system, defaults to /etc/sysconfig/icinga2")
endif()
configure_file(initsystem/icinga2.sysconfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.sysconfig @ONLY)
get_filename_component(ICINGA2_SYSCONFIGFILE_NAME ${ICINGA2_SYSCONFIGFILE} NAME)
get_filename_component(ICINGA2_SYSCONFIGFILE_DIR ${ICINGA2_SYSCONFIGFILE} PATH)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.sysconfig
DESTINATION ${ICINGA2_SYSCONFIGFILE_DIR}
RENAME ${ICINGA2_SYSCONFIGFILE_NAME}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install(
FILES initsystem/icinga2-prepare-dirs
DESTINATION ${CMAKE_INSTALL_SBINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
option (USE_SYSTEMD
"Configure icinga as native systemd service instead of a SysV initscript" OFF)
if (NOT USE_SYSTEMD)
configure_file(initsystem/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()
configure_file(initsystem/icinga2.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service
DESTINATION ${DESTDIR}/usr/lib/systemd/system
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()
add_subdirectory(initsystem)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)

View File

@ -0,0 +1,58 @@
# Icinga 2
# Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
if(NOT WIN32)
if(NOT DEFINED ICINGA2_SYSCONFIGFILE)
set(ICINGA2_SYSCONFIGFILE "${CMAKE_INSTALL_SYSCONFDIR}/sysconfig/icinga2" CACHE PATH "where to store configuation for the init system, defaults to /etc/sysconfig/icinga2")
endif()
configure_file(icinga2.sysconfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.sysconfig @ONLY)
get_filename_component(ICINGA2_SYSCONFIGFILE_NAME ${ICINGA2_SYSCONFIGFILE} NAME)
get_filename_component(ICINGA2_SYSCONFIGFILE_DIR ${ICINGA2_SYSCONFIGFILE} PATH)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.sysconfig
DESTINATION ${ICINGA2_SYSCONFIGFILE_DIR}
RENAME ${ICINGA2_SYSCONFIGFILE_NAME}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install(
FILES icinga2-prepare-dirs
DESTINATION ${CMAKE_INSTALL_SBINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
option (USE_SYSTEMD
"Configure icinga as native systemd service instead of a SysV initscript" OFF)
if (NOT USE_SYSTEMD)
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()
configure_file(icinga2.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service
DESTINATION ${DESTDIR}/usr/lib/systemd/system
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()