From aed88c632c7d789b83a9b4bb0e3f3dfac3652094 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 10 Jun 2014 13:46:45 +0200 Subject: [PATCH] spec: Fix rhel/suse conditiations with {pre,post}un. Refs #6446 Refs #6374 --- icinga2.spec | 52 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index c6bd48acb..5e1ca0b8b 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -274,9 +274,10 @@ getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacm getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user} exit 0 +%post # suse %if 0%{?suse_version} -%post + %{fillup_and_insserv icinga2} if [ ${1:-0} -eq 1 ] @@ -286,24 +287,9 @@ then fi exit 0 -%postun -%restart_on_update icinga2 -%insserv_cleanup - -if [ "$1" = "0" ]; then - # deinstallation of the package - remove enabled features - rm -rf %{_sysconfdir}/%{name}/features-enabled -fi - -exit 0 - -%preun -%stop_on_removal icinga2 - -# rhel %else +# rhel -%post /sbin/chkconfig --add icinga2 if [ ${1:-0} -eq 1 ] @@ -314,7 +300,26 @@ fi exit 0 +%endif +# suse/rhel + %postun +# suse +%if 0%{?suse_version} + +%restart_on_update icinga2 +%insserv_cleanup + +if [ "$1" = "0" ]; then + # deinstallation of the package - remove enabled features + rm -rf %{_sysconfdir}/%{name}/features-enabled +fi + +exit 0 + +%else +# rhel + if [ "$1" -ge "1" ]; then /sbin/service icinga2 condrestart >/dev/null 2>&1 || : fi @@ -325,14 +330,25 @@ if [ "$1" = "0" ]; then fi exit 0 +%endif +# suse / rhel + %preun +# suse +%if 0%{?suse_version} + +%stop_on_removal icinga2 + +%else +# rhel + if [ "$1" = "0" ]; then /sbin/service icinga2 stop > /dev/null 2>&1 /sbin/chkconfig --del icinga2 fi %endif -# suse/rhel +# suse / rhel %post ido-mysql if [ ${1:-0} -eq 1 ]