mirror of https://github.com/Icinga/icinga2.git
Move the sysdefines.conf file to /etc/sysconfig.
As /etc/sysconfig is distro specific, the filename used can be configured via the CMake parameter ICINGA2_SYSCONFIGFILE Refs #4794
This commit is contained in:
parent
83528f660f
commit
dd9b7bcd73
|
@ -76,10 +76,17 @@ else()
|
|||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
configure_file(icinga2/sysdefines.conf.cmake ${CMAKE_CURRENT_BINARY_DIR}/icinga2/sysdefines.conf @ONLY)
|
||||
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}/icinga2/sysdefines.conf
|
||||
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/icinga2
|
||||
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
|
||||
)
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#
|
||||
|
||||
# load system specific defines
|
||||
SYSDEFFILE=$1
|
||||
if [ -f "$SYSDEFFILE" ]; then
|
||||
. $SYSDEFFILE
|
||||
SYSCONFIGFILE=$1
|
||||
if [ -f "$SYSCONFIGFILE" ]; then
|
||||
. $SYSCONFIGFILE
|
||||
else
|
||||
echo "Error: You need to supply the path to the Icinga2 sysdefines.conf as parameter."
|
||||
echo "Error: You need to supply the path to the Icinga2 sysconfig file as parameter."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
### END INIT INFO
|
||||
|
||||
# load system specific defines
|
||||
SYSDEFFILE=@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2/sysdefines.conf
|
||||
if [ -f $SYSDEFFILE ]; then
|
||||
. $SYSDEFFILE
|
||||
SYSCONFIGFILE=@ICINGA2_SYSCONFIGFILE@
|
||||
if [ -f $SYSCONFIGFILE ]; then
|
||||
. $SYSCONFIGFILE
|
||||
else
|
||||
echo "Can't load system specific defines from $SYSDEFFILE."
|
||||
echo "Can't load system specific defines from $SYSCONFIGFILE."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -39,17 +39,14 @@ elif [ -f /etc/init.d/functions ]; then
|
|||
fi
|
||||
|
||||
# Load extra environment variables
|
||||
if [ -f /etc/sysconfig/icinga ]; then
|
||||
. /etc/sysconfig/icinga
|
||||
fi
|
||||
if [ -f /etc/default/icinga ]; then
|
||||
. /etc/default/icinga
|
||||
if [ -f /etc/default/icinga2 ]; then
|
||||
. /etc/default/icinga2
|
||||
fi
|
||||
|
||||
# Start Icinga 2
|
||||
start() {
|
||||
printf "Starting Icinga 2: "
|
||||
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-prepare-dirs $SYSDEFFILE
|
||||
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-prepare-dirs $SYSCONFIGFILE
|
||||
|
||||
if ! $DAEMON -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG -u $ICINGA2_USER -g $ICINGA2_GROUP > $ICINGA2_STARTUP_LOG 2>&1; then
|
||||
echo "Error starting Icinga. Check '$ICINGA2_STARTUP_LOG' for details."
|
||||
|
|
|
@ -4,8 +4,8 @@ After=syslog.target postgresql.service mariadb.service
|
|||
|
||||
[Service]
|
||||
Type=forking
|
||||
EnvironmentFile=@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2/sysdefines.conf
|
||||
ExecStartPre=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-prepare-dirs @CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2/sysdefines.conf
|
||||
EnvironmentFile=@ICINGA2_SYSCONFIGFILE@
|
||||
ExecStartPre=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-prepare-dirs @ICINGA2_SYSCONFIGFILE@
|
||||
ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 -c ${ICINGA2_CONFIG_FILE} -d -e ${ICINGA2_ERROR_LOG} -u ${ICINGA2_USER} -g ${ICINGA2_GROUP}
|
||||
PIDFile=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/run/icinga2/icinga2.pid
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
|
|
|
@ -458,13 +458,13 @@ exit 0
|
|||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/sysdefines.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/*.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/localhost/*.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
|
||||
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/*
|
||||
%config(noreplace) %{_sysconfdir}/%{name}/scripts/*
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
%{_sbindir}/%{name}
|
||||
%{_bindir}/%{name}-build-ca
|
||||
%{_bindir}/%{name}-build-key
|
||||
|
|
Loading…
Reference in New Issue