From 7910a8fa375ba1fd58e21289bd79e43ce3742af7 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 25 Nov 2013 17:35:44 +0100 Subject: [PATCH] Fix RPM warnings. Fixes #5193 --- etc/init.d/icinga2.cmake | 15 +++++++++++---- icinga2.spec | 23 +++++++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/etc/init.d/icinga2.cmake b/etc/init.d/icinga2.cmake index 97ecac266..7b1156860 100644 --- a/etc/init.d/icinga2.cmake +++ b/etc/init.d/icinga2.cmake @@ -15,10 +15,13 @@ DAEMON=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 ICINGA2_CONFIG_FILE=@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2/icinga2.conf -ICINGA2_PID_FILE=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/run/icinga2/icinga2.pid -ICINGA2_ERROR_LOG=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/error.log +ICINGA2_STATE_DIR=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@ +ICINGA2_PID_FILE=$ICINGA2_STATE_DIR/run/icinga2/icinga2.pid +ICINGA2_ERROR_LOG=$ICINGA2_STATE_DIR/log/icinga2/error.log ICINGA2_USER=@ICINGA2_USER@ ICINGA2_GROUP=@ICINGA2_GROUP@ +ICINGA2_COMMAND_USER=@ICINGA2_COMMAND_USER@ +ICINGA2_COMMAND_GROUP=@ICINGA2_COMMAND_GROUP@ test -x $DAEMON || exit 0 @@ -44,8 +47,12 @@ fi # Start Icinga 2 start() { - mkdir -p `dirname -- $ICINGA2_PID_FILE` - mkdir -p `dirname -- $ICINGA2_ERROR_LOG` + mkdir -p $(dirname -- $ICINGA2_PID_FILE) + mkdir -p $(dirname -- $ICINGA2_ERROR_LOG) + + mkdir -p $ICINGA2_STATE_DIR/run/icinga2/cmd + chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_STATE_DIR/run/icinga2/cmd + chmod 2755 $ICINGA2_STATE_DIR/run/icinga2/cmd echo "Validating the configuration file:" if ! $DAEMON -c $ICINGA2_CONFIG_FILE -C; then diff --git a/icinga2.spec b/icinga2.spec index b773a9046..21c229c1b 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -45,7 +45,7 @@ %define logmsg logger -t %{name}/rpm -Summary: network monitoring application +Summary: Network monitoring application Name: icinga2 Version: 0.0.4 Release: %{revision}%{?dist} @@ -259,12 +259,16 @@ then %{_sbindir}/icinga2-enable-feature ido-mysql fi +exit 0 + %postun ido-mysql if [ "$1" = "0" ]; then # deinstallation of the package - remove feature test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql fi +exit 0 + %post ido-pgsql if [ ${1:-0} -eq 1 ] then @@ -272,12 +276,16 @@ then %{_sbindir}/icinga2-enable-feature ido-pgsql fi +exit 0 + %postun ido-pgsql if [ "$1" = "0" ]; then # deinstallation of the package - remove feature test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql fi +exit 0 + %post classicui-config if [ ${1:-0} -eq 1 ] then @@ -287,6 +295,8 @@ then %{_sbindir}/icinga2-enable-feature command fi +exit 0 + %postun classicui-config if [ "$1" = "0" ]; then # deinstallation of the package - remove feature @@ -295,17 +305,20 @@ if [ "$1" = "0" ]; then test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command fi +exit 0 + %files %defattr(-,root,root,-) %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog %attr(755,-,-) %{_sysconfdir}/init.d/%{name} +%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf -%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-enabled/*.conf +%config(noreplace) %{_sysconfdir}/%{name}/features-enabled/*.conf %{_sbindir}/%{name} %{_bindir}/%{name}-migrate-config %{_bindir}/%{name}-build-ca @@ -313,6 +326,7 @@ fi %{_sbindir}/%{name}-enable-feature %{_sbindir}/%{name}-disable-feature %exclude %{_libdir}/%{name}/libdb_ido_mysql* +%exclude %{_libdir}/%{name}/libdb_ido_pgsql* %{_libdir}/%{name} %{_datadir}/%{name} %exclude %{_datadir}/%{name}/itl @@ -322,10 +336,10 @@ fi %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name} %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives -%attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/run/%{name} +%attr(0755,%{icinga_user},%{icinga_group}) %ghost %{_localstatedir}/run/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name} -%attr(2755,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/run/icinga2/cmd +%attr(2755,%{icinga_user},%{icingacmd_group}) %ghost %{_localstatedir}/run/icinga2/cmd %files common %defattr(-,root,root,-) @@ -354,6 +368,7 @@ fi %files classicui-config %defattr(-,root,root,-) +%attr(0750,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir} %config(noreplace) %{icingaclassicconfdir}/cgi.cfg %config(noreplace) %{apacheconfdir}/icinga.conf %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd -- 2.40.0