Hello Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/13815
to review the following change.
Change subject: spec: use the fedora systemd macros
......................................................................
spec: use the fedora systemd macros
Add the support for the fedora systemd macros introduced in fedora 18.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=850412
Change-Id: I76857a6b9ae1a945511f359333735b9497c5e2b0
Signed-off-by: Federico Simoncelli <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/12285
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M vdsm.spec.in
1 file changed, 29 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/13815/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index daf29f6..46ddb46 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -3,9 +3,6 @@
%global vdsm_bootstrap vdsm-bootstrap
%global vdsm_reg vdsm-reg
-# Gluster
-%global with_gluster 1
-
# Required users and groups
%global vdsm_user @VDSMUSER@
%global vdsm_group @VDSMGROUP@
@@ -20,13 +17,15 @@
%global _polkitdir %{_localstatedir}/lib/polkit-1/localauthority/10-vendor.d
%endif
-# Systemd macro
-%if 0%{?fedora} >= 15
+# Gluster
+%global with_gluster 1
+
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%global with_systemd 1
%endif
-%if 0%{?rhel} >= 7
-%global with_systemd 1
+%if 0%{?fedora} >= 18
+%global with_systemd_macros 1
%endif
# Default to skipping autoreconf. Distros can change just this one line
@@ -471,7 +470,7 @@
install -Dm 0755 vdsm/vdsmd.init %{buildroot}/lib/systemd/systemd-vdsmd
install -Dm 0644 vdsm/vdsmd.service %{buildroot}%{_unitdir}/vdsmd.service
install -Dm 0644 vdsm/vdsm-restore-net-config.service \
- %{buildroot}%{_unitdir}/vdsm-restore-net-config.service
+ %{buildroot}%{_unitdir}/vdsm-restore-net-config.service
install -Dm 0755 vdsm_reg/vdsm-reg.init \
%{buildroot}/lib/systemd/systemd-vdsm-reg
install -Dm 0644 vdsm_reg/vdsm-reg.service \
@@ -540,12 +539,17 @@
/sbin/chkconfig --add vdsm-restore-net-config
fi
%else
+%if 0%{?with_systemd_macros}
+%systemd_post vdsmd.service
+%systemd_post vdsm-restore-net-config.service
+%else
if [ "$1" -eq 1 ] ; then
/bin/systemctl enable vdsmd.service >/dev/null 2>&1 || :
/bin/systemctl enable vdsm-restore-net-config.service >/dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
exit 0
+%endif
%endif
%preun
@@ -586,12 +590,17 @@
fi
fi
%else
+%if 0%{?with_systemd_macros}
+%systemd_preun vdsmd.service
+%systemd_preun vdsm-restore-net-config.service
+%else
if [ "$1" -eq 0 ]; then
/bin/systemctl --no-reload disable vdsmd.service > /dev/null 2>&1 || :
/bin/systemctl --no-reload disable vdsm-restore-net-config.service >
/dev/null 2>&1 || :
/bin/systemctl stop vdsmd.service > /dev/null 2>&1 || :
fi
exit 0
+%endif
%endif
%postun
@@ -601,10 +610,14 @@
fi
exit 0
%else
+%if 0%{?with_systemd_macros}
+%systemd_postun_with_restart vdsmd.service
+%else
if [ "$1" -ge 1 ] ; then
/bin/systemctl try-restart vdsmd.service >/dev/null 2>&1 || :
fi
exit 0
+%endif
%endif
%if 0%{?rhel}
@@ -625,11 +638,15 @@
/sbin/chkconfig --add vdsm-reg
fi
%else
+%if 0%{?with_systemd_macros}
+%systemd_post vdsm-reg.service
+%else
if [ "$1" -eq 1 ] ; then
/bin/systemctl enable vdsm-reg.service >/dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
exit 0
+%endif
%endif
%preun reg
@@ -640,12 +657,16 @@
/sbin/chkconfig --del vdsm-reg
fi
%else
+%if 0%{?with_systemd_macros}
+%systemd_preun vdsm-reg.service
+%else
if [ "$1" -eq 0 ]; then
/bin/systemctl --no-reload disable vdsm-reg.service > /dev/null 2>&1 || :
/bin/systemctl stop vdsm-reg.service > /dev/null 2>&1 || :
fi
exit 0
%endif
+%endif
%files
%defattr(-, root, root, -)
--
To view, visit http://gerrit.ovirt.org/13815
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I76857a6b9ae1a945511f359333735b9497c5e2b0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches