# HG changeset patch
# User Kazunori INOUE <kazunori.inoue3@gmail.com>
# Date 1403151042 -32400
# Node ID 7a0ee2aa786f3b5ff728d9a940d086149d29ca5a
# Parent  45e21bc9795d70b86ecc3825b91ef6424db178d8
build: update fedora.spec for systemd

diff -r 45e21bc9795d -r 7a0ee2aa786f cluster-glue-fedora.spec
--- a/cluster-glue-fedora.spec	Thu Jun 12 12:28:59 2014 +0200
+++ b/cluster-glue-fedora.spec	Thu Jun 19 13:10:42 2014 +0900
@@ -60,6 +60,11 @@
 BuildRequires: e2fsprogs-devel
 %endif
 
+%if %{defined systemd_requires}
+BuildRequires:  systemd
+%{?systemd_requires}
+%endif
+
 %prep
 %setup -q -n cluster-glue
 
@@ -82,6 +87,9 @@
     --with-daemon-user=%{uname} \
     --localstatedir=%{_var} \
     --libdir=%{_libdir} \
+%if %{defined _unitdir}
+    --with-systemdsystemunitdir=%{_unitdir} \
+%endif
     --docdir=%{glue_docdir}
 %endif
 
@@ -112,7 +120,11 @@
 %files
 %defattr(-,root,root)
 %dir %{_datadir}/%{name}
+%if %{defined _unitdir}
+%{_unitdir}/logd.service
+%else
 %{_sysconfdir}/init.d/logd
+%endif
 %{_datadir}/%{name}/ha_cf_support.sh
 %{_datadir}/%{name}/openais_conf_support.sh
 %{_datadir}/%{name}/utillib.sh
@@ -176,6 +188,17 @@
 -c "cluster user" %{uname}
 exit 0
 
+%if %{defined _unitdir}
+%post
+%systemd_post logd.service
+
+%preun
+%systemd_preun logd.service
+
+%postun
+%systemd_postun_with_restart logd.service
+%endif
+
 %post -n cluster-glue-libs -p /sbin/ldconfig
 
 %postun -n cluster-glue-libs -p /sbin/ldconfig
