Blob Blame History Raw
From b5ac234ee8d8d4e44279cb69f9c59ccee6f5f31b Mon Sep 17 00:00:00 2001
From: Aravinda VK <avishwan@redhat.com>
Date: Tue, 18 Oct 2016 14:57:47 +0530
Subject: [PATCH 140/140] eventsapi/packaging: Fix wrong usage of %post

%postun was used for events package instead of %post. eventsd
service should be restarted only after install/upgrade and not
during uninstallation(%postun)

> Reviewed-on: http://review.gluster.org/15670
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>

BUG: 1380605
Change-Id: Iae3eab06d02c5f4134b3de09f040123bed053bb8
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/88030
Reviewed-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 glusterfs.spec.in | 31 ++++++++++++++++++++++---------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 9501c05..28517b9 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -131,6 +131,7 @@
 # can't seem to make a generic macro that works
 %global _init_glusterd   %{_unitdir}/glusterd.service
 %global _init_glusterfsd %{_unitdir}/glusterfsd.service
+%global _init_glustereventsd %{_unitdir}/glustereventsd.service
 %else
 %global _init_enable()  /sbin/chkconfig --add %1 ;
 %global _init_disable() /sbin/chkconfig --del %1 ;
@@ -141,6 +142,7 @@
 # can't seem to make a generic macro that works
 %global _init_glusterd   %{_sysconfdir}/init.d/glusterd
 %global _init_glusterfsd %{_sysconfdir}/init.d/glusterfsd
+%global _init_glustereventsd %{_sysconfdir}/init.d/glustereventsd
 %endif
 
 %if ( 0%{_for_fedora_koji_builds} )
@@ -811,6 +813,13 @@ exit 0
 %post api
 /sbin/ldconfig
 
+%if ( 0%{?_build_server} )
+%if ( 0%{!?_without_events:1} )
+%post events
+%_init_restart glustereventsd
+%endif
+%endif
+
 %if ( 0%{?rhel} == 5 )
 %post fuse
 modprobe fuse
@@ -911,6 +920,19 @@ fi
 ## All %%preun should be placed here and keep them sorted
 ##
 %if ( 0%{?_build_server} )
+%if ( 0%{!?_without_events:1} )
+%preun events
+if [ $1 -eq 0 ]; then
+    if [ -f %_init_glustereventsd ]; then
+        %_init_stop glustereventsd
+        %_init_disable glustereventsd
+    fi
+fi
+exit 0
+%endif
+%endif
+
+%if ( 0%{?_build_server} )
 %preun server
 if [ $1 -eq 0 ]; then
     if [ -f %_init_glusterfsd ]; then
@@ -944,15 +966,6 @@ fi
 %postun api
 /sbin/ldconfig
 
-%if 0%{?_build_server}
-%postun events
-%if ( 0%{!?_without_events:1} )
-%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 )
-%_init_restart glustereventsd
-%endif
-%endif
-%endif
-
 %postun libs
 /sbin/ldconfig
 
-- 
2.7.4