[icinga-checkins] icinga.org: icinga2/next: Generate the service unit on Fedora and use the %systemd_post/_postun/ _preun macros for service setup

git at icinga.org git at icinga.org
Sun Jun 15 20:27:42 CEST 2014


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

Author: Sam Kottler <shk at linux.com>
Date:   Tue May 27 03:26:38 2014 -0400

Generate the service unit on Fedora and use the %systemd_post/_postun/_preun macros for service setup

Refs #4794

---

 icinga2.spec |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/icinga2.spec b/icinga2.spec
index 3372fb6..035a3f8 100644
--- a/icinga2.spec
+++ b/icinga2.spec
@@ -245,6 +245,11 @@ CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
  -DBoost_NO_SYSTEM_PATHS=TRUE \
  -DBUILD_TESTING=FALSE \
  -DBoost_NO_BOOST_CMAKE=TRUE"
+
+%if 0%{?fedora}
+CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON"
+%endif
+
 %endif
 %endif
 
@@ -294,7 +299,11 @@ exit 0
 %else
 # rhel
 
+%if 0%{?el5}{?el6}
 /sbin/chkconfig --add %{name}
+%else
+%systemd_post %{name}.service
+%endif
 
 if [ ${1:-0} -eq 1 ]
 then
@@ -324,9 +333,13 @@ exit 0
 %else
 # rhel
 
+%if 0%{?el5}{?el6}
 if [ "$1" -ge  "1" ]; then
 	/sbin/service %{name} condrestart >/dev/null 2>&1 || :
 fi
+%else
+%systemd_postun_with_restart %{name}.service
+%endif
 
 if [ "$1" = "0" ]; then
 	# deinstallation of the package - remove enabled features
@@ -350,10 +363,14 @@ exit 0
 %else
 # rhel
 
+%if 0%{?el5}{?el6}
 if [ "$1" = "0" ]; then
 	/sbin/service %{name} stop > /dev/null 2>&1 || :
 	/sbin/chkconfig --del %{name} || :
 fi
+%else
+%systemd_preun %{name}.service
+%endif
 
 exit 0
 



More information about the icinga-checkins mailing list