[icinga-checkins] icinga.org: icinga2/next: Spec file fixes for opensuse, preun macro, conditionals.

git at icinga.org git at icinga.org
Wed Jun 11 15:54:48 CEST 2014


Module: icinga2
Branch: next
Commit: 64bdc7602a83b91bd50b9e443f7ce6b27537cadd
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=64bdc7602a83b91bd50b9e443f7ce6b27537cadd

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Wed Jun 11 15:52:41 2014 +0200

Spec file fixes for opensuse, preun macro, conditionals.

Fixes #6446

---

 icinga2.spec |   35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/icinga2.spec b/icinga2.spec
index 5e1ca0b..675cfc8 100644
--- a/icinga2.spec
+++ b/icinga2.spec
@@ -274,23 +274,22 @@ 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
+# all restart/feature actions belong to icinga2-bin
+%post bin
 # suse
 %if 0%{?suse_version}
 
-%{fillup_and_insserv icinga2}
+%fillup_and_insserv %{name}
 
-if [ ${1:-0} -eq 1 ]
-then
-	# initial installation, enable default features
-	%{_sbindir}/icinga2-enable-feature checker notification mainlog
-fi
+# initial installation, enable default features
+%{_sbindir}/icinga2-enable-feature checker notification mainlog
 
 exit 0
+
 %else
 # rhel
 
-/sbin/chkconfig --add icinga2
+/sbin/chkconfig --add %{name}
 
 if [ ${1:-0} -eq 1 ]
 then
@@ -303,11 +302,11 @@ exit 0
 %endif
 # suse/rhel
 
-%postun
+%postun bin
 # suse
 %if 0%{?suse_version}
 
-%restart_on_update icinga2
+%restart_on_update %{name}
 %insserv_cleanup
 
 if [ "$1" = "0" ]; then
@@ -321,7 +320,7 @@ exit 0
 # rhel
 
 if [ "$1" -ge  "1" ]; then
-	/sbin/service icinga2 condrestart >/dev/null 2>&1 || :
+	/sbin/service %{name} condrestart >/dev/null 2>&1 || :
 fi
 
 if [ "$1" = "0" ]; then
@@ -333,20 +332,26 @@ exit 0
 %endif
 # suse / rhel
 
-%preun
+%preun bin
 # suse
 %if 0%{?suse_version}
 
-%stop_on_removal icinga2
+if [ "$1" = "0" ]; then
+	%stop_on_removal %{name}
+fi
+
+exit 0
 
 %else
 # rhel
 
 if [ "$1" = "0" ]; then
-	/sbin/service icinga2 stop > /dev/null 2>&1
-	/sbin/chkconfig --del icinga2
+	/sbin/service %{name} stop > /dev/null 2>&1 || :
+	/sbin/chkconfig --del %{name} || :
 fi
 
+exit 0
+
 %endif
 # suse / rhel
 



More information about the icinga-checkins mailing list