
On Thu, Jul 25, 2013 at 03:52:36PM +0800, Xu Wang wrote:
Only when version of Fedora more than/equal with 17 or version of RHEL more than/equal with 7, the system could use systemd to manage services. Except above systems only "service" command could be used instead of systemctl. This patch checks system version before restart service after installation finished and decide which command to be used to avoid "systemctl: Command not found" error happened on some system such as RHEL6.4.
Signed-off-by: Xu Wang <cngesaint@gmail.com> --- libvirt-cim.spec.in | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in index d024c59..7b6221e 100644 --- a/libvirt-cim.spec.in +++ b/libvirt-cim.spec.in @@ -89,15 +89,19 @@ rm -fr $RPM_BUILD_ROOT
%{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name}
-if [ "`systemctl is-active tog-pegasus.service`" = "active" ] -then - systemctl restart tog-pegasus.service -fi - -if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] -then - systemctl restart sblim-sfcb.service -fi +%if 0%{?Fedora} >= 17 || 0%{?rhel} >= 7 + if [ "`systemctl is-active tog-pegasus.service`" = "active" ] + then + systemctl restart tog-pegasus.service + fi + + if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] + then + systemctl restart sblim-sfcb.service + fi +%else + /etc/init.d/tog-pegasus condrestart +%endif
if [ -x /usr/sbin/cimserver ] then -- 1.7.1
okay, it's reasonable to keep this working on RHEL-6 for example, I didn't realized I had broken this, ACK, and pushed, thanks ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/