a3470f
From cac41ae2729cffa23a348c4de14486043ef08163 Mon Sep 17 00:00:00 2001
a3470f
From: "Bala.FA" <barumuga@redhat.com>
a3470f
Date: Sat, 11 Nov 2017 10:32:42 +0530
a3470f
Subject: [PATCH 08/74] build: add RHGS specific changes
a3470f
a3470f
Label: DOWNSTREAM ONLY
a3470f
a3470f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1074947
a3470f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1097782
a3470f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115267
a3470f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1221743
a3470f
Change-Id: I08333334745adf2350e772c6454ffcfe9c08cb89
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/24983
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/25451
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/25518
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/25983
a3470f
Signed-off-by: Bala.FA <barumuga@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/60134
a3470f
Tested-by: Milind Changire <mchangir@redhat.com>
a3470f
---
a3470f
 glusterfs.spec.in | 605 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
a3470f
 1 file changed, 597 insertions(+), 8 deletions(-)
a3470f
a3470f
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
a3470f
index 3be99b6..8458e8a 100644
a3470f
--- a/glusterfs.spec.in
a3470f
+++ b/glusterfs.spec.in
a3470f
@@ -80,6 +80,23 @@
a3470f
 %global _without_tiering --disable-tiering
a3470f
 %endif
a3470f
 
a3470f
+# if you wish not to build server rpms, compile like this.
a3470f
+# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without server
a3470f
+
a3470f
+%global _build_server 1
a3470f
+%if "%{?_without_server}"
a3470f
+%global _build_server 0
a3470f
+%endif
a3470f
+
a3470f
+%if ( "%{?dist}" == ".el6rhs" ) || ( "%{?dist}" == ".el7rhs" ) || ( "%{?dist}" == ".el7rhgs" )
a3470f
+%global _build_server 1
a3470f
+%else
a3470f
+%global _build_server 0
a3470f
+%endif
a3470f
+
a3470f
+%global _without_extra_xlators 1
a3470f
+%global _without_regression_tests 1
a3470f
+
a3470f
 ##-----------------------------------------------------------------------------
a3470f
 ## All %%global definitions should be placed here and keep them sorted
a3470f
 ##
a3470f
@@ -178,7 +195,8 @@ Release:          0.1%{?prereltag:.%{prereltag}}%{?dist}
a3470f
 %else
a3470f
 Name:             @PACKAGE_NAME@
a3470f
 Version:          @PACKAGE_VERSION@
a3470f
-Release:          0.@PACKAGE_RELEASE@%{?dist}
a3470f
+Release:          @PACKAGE_RELEASE@%{?dist}
a3470f
+ExclusiveArch:    x86_64 aarch64
a3470f
 %endif
a3470f
 License:          GPLv2 or LGPLv3+
a3470f
 Group:            System Environment/Base
a3470f
@@ -320,7 +338,9 @@ Summary:          Development Libraries
a3470f
 Group:            Development/Libraries
a3470f
 Requires:         %{name}%{?_isa} = %{version}-%{release}
a3470f
 # Needed for the Glupy examples to work
a3470f
-Requires:         %{name}-extra-xlators%{?_isa} = %{version}-%{release}
a3470f
+%if ( 0%{!?_without_extra_xlators:1} )
a3470f
+Requires:         %{name}-extra-xlators = %{version}-%{release}
a3470f
+%endif
a3470f
 
a3470f
 %description devel
a3470f
 GlusterFS is a distributed file-system capable of scaling to several
a3470f
@@ -333,6 +353,7 @@ is in user space and easily manageable.
a3470f
 
a3470f
 This package provides the development libraries and include files.
a3470f
 
a3470f
+%if ( 0%{!?_without_extra_xlators:1} )
a3470f
 %package extra-xlators
a3470f
 Summary:          Extra Gluster filesystem Translators
a3470f
 Group:            Applications/File
a3470f
@@ -355,6 +376,7 @@ is in user space and easily manageable.
a3470f
 
a3470f
 This package provides extra filesystem Translators, such as Glupy,
a3470f
 for GlusterFS.
a3470f
+%endif
a3470f
 
a3470f
 %package fuse
a3470f
 Summary:          Fuse client
a3470f
@@ -381,6 +403,31 @@ is in user space and easily manageable.
a3470f
 This package provides support to FUSE based clients and inlcudes the
a3470f
 glusterfs(d) binary.
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
+%package ganesha
a3470f
+Summary:          NFS-Ganesha configuration
a3470f
+Group:            Applications/File
a3470f
+
a3470f
+Requires:         %{name}-server%{?_isa} = %{version}-%{release}
a3470f
+Requires:         nfs-ganesha-gluster, pcs, dbus
a3470f
+%if ( 0%{?rhel} && 0%{?rhel} == 6 )
a3470f
+Requires:         cman, pacemaker, corosync
a3470f
+%endif
a3470f
+
a3470f
+%description ganesha
a3470f
+GlusterFS is a distributed file-system capable of scaling to several
a3470f
+petabytes. It aggregates various storage bricks over Infiniband RDMA
a3470f
+or TCP/IP interconnect into one large parallel network file
a3470f
+system. GlusterFS is one of the most sophisticated file systems in
a3470f
+terms of features and extensibility.  It borrows a powerful concept
a3470f
+called Translators from GNU Hurd kernel. Much of the code in GlusterFS
a3470f
+is in user space and easily manageable.
a3470f
+
a3470f
+This package provides the configuration and related files for using
a3470f
+NFS-Ganesha as the NFS server using GlusterFS
a3470f
+%endif
a3470f
+
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_georeplication:1} )
a3470f
 %package geo-replication
a3470f
 Summary:          GlusterFS Geo-replication
a3470f
@@ -406,6 +453,7 @@ is in userspace and easily manageable.
a3470f
 
a3470f
 This package provides support to geo-replication.
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
 %if ( 0%{?_with_gnfs:1} )
a3470f
 %package gnfs
a3470f
@@ -498,6 +546,8 @@ is in user space and easily manageable.
a3470f
 This package provides support to ib-verbs library.
a3470f
 %endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
+%if ( 0%{!?_without_regression_tests:1} )
a3470f
 %package regression-tests
a3470f
 Summary:          Development Tools
a3470f
 Group:            Development/Tools
a3470f
@@ -513,7 +563,10 @@ Requires:         nfs-utils xfsprogs yajl psmisc bc
a3470f
 %description regression-tests
a3470f
 The Gluster Test Framework, is a suite of scripts used for
a3470f
 regression testing of Gluster.
a3470f
+%endif
a3470f
+%endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_ocf:1} )
a3470f
 %package resource-agents
a3470f
 Summary:          OCF Resource Agents for GlusterFS
a3470f
@@ -546,7 +599,9 @@ This package provides the resource agents which plug glusterd into
a3470f
 Open Cluster Framework (OCF) compliant cluster resource managers,
a3470f
 like Pacemaker.
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %package server
a3470f
 Summary:          Clustered file-system server
a3470f
 Group:            System Environment/Daemons
a3470f
@@ -602,6 +657,7 @@ called Translators from GNU Hurd kernel. Much of the code in GlusterFS
a3470f
 is in user space and easily manageable.
a3470f
 
a3470f
 This package provides the glusterfs server daemon.
a3470f
+%endif
a3470f
 
a3470f
 %package client-xlators
a3470f
 Summary:          GlusterFS client-side translators
a3470f
@@ -618,6 +674,7 @@ is in user space and easily manageable.
a3470f
 
a3470f
 This package provides the translators needed on any GlusterFS client.
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_events:1} )
a3470f
 %package events
a3470f
 Summary:          GlusterFS Events
a3470f
@@ -641,6 +698,7 @@ Requires:         python-argparse
a3470f
 GlusterFS Events
a3470f
 
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
 %prep
a3470f
 %setup -q -n %{name}-%{version}%{?prereltag}
a3470f
@@ -822,10 +880,12 @@ exit 0
a3470f
 %post api
a3470f
 /sbin/ldconfig
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_events:1} )
a3470f
 %post events
a3470f
 %_init_restart glustereventsd
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
 %if ( 0%{?rhel} == 5 )
a3470f
 %post fuse
a3470f
@@ -833,6 +893,7 @@ modprobe fuse
a3470f
 exit 0
a3470f
 %endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_georeplication:1} )
a3470f
 %post geo-replication
a3470f
 if [ $1 -ge 1 ]; then
a3470f
@@ -840,10 +901,12 @@ if [ $1 -ge 1 ]; then
a3470f
 fi
a3470f
 exit 0
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
 %post libs
a3470f
 /sbin/ldconfig
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %post server
a3470f
 # Legacy server
a3470f
 %_init_enable glusterd
a3470f
@@ -914,7 +977,7 @@ else
a3470f
     #rpm_script_t context.
a3470f
     rm -f %{_rundir}/glusterd.socket
a3470f
 fi
a3470f
-exit 0
a3470f
+%endif
a3470f
 
a3470f
 ##-----------------------------------------------------------------------------
a3470f
 ## All %%pre should be placed here and keep them sorted
a3470f
@@ -928,6 +991,7 @@ exit 0
a3470f
 ##-----------------------------------------------------------------------------
a3470f
 ## All %%preun should be placed here and keep them sorted
a3470f
 ##
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_events:1} )
a3470f
 %preun events
a3470f
 if [ $1 -eq 0 ]; then
a3470f
@@ -956,7 +1020,7 @@ if [ $1 -ge 1 ]; then
a3470f
     fi
a3470f
     %_init_restart glusterd
a3470f
 fi
a3470f
-exit 0
a3470f
+%endif
a3470f
 
a3470f
 ##-----------------------------------------------------------------------------
a3470f
 ## All %%postun should be placed here and keep them sorted
a3470f
@@ -986,6 +1050,73 @@ exit 0
a3470f
 ## All %%files should be placed here and keep them grouped
a3470f
 ##
a3470f
 %files
a3470f
+# exclude extra-xlators files
a3470f
+%if ( ! 0%{!?_without_extra_xlators:1} )
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quiesce.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/selinux.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/features/template.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance/symlink-cache.so
a3470f
+%exclude %{python_sitelib}/*
a3470f
+%endif
a3470f
+# exclude regression-tests files
a3470f
+%if ( ! 0%{!?_without_regression_tests:1} )
a3470f
+%exclude %{_prefix}/share/glusterfs/run-tests.sh
a3470f
+%exclude %{_prefix}/share/glusterfs/tests/*
a3470f
+%endif
a3470f
+%if ( ! 0%{?_build_server} )
a3470f
+# exclude ganesha files
a3470f
+%exclude %{_prefix}/lib/ocf/*
a3470f
+# exclude geo-replication files
a3470f
+%exclude %{_sysconfdir}/logrotate.d/glusterfs-georep
a3470f
+%exclude %{_libexecdir}/glusterfs/*
a3470f
+%exclude %{_sbindir}/gfind_missing_files
a3470f
+%exclude %{_datadir}/glusterfs/scripts/get-gfid.sh
a3470f
+%exclude %{_datadir}/glusterfs/scripts/slave-upgrade.sh
a3470f
+%exclude %{_datadir}/glusterfs/scripts/gsync-upgrade.sh
a3470f
+%exclude %{_datadir}/glusterfs/scripts/generate-gfid-file.sh
a3470f
+%exclude %{_datadir}/glusterfs/scripts/gsync-sync-gfid
a3470f
+%exclude %{_sharedstatedir}/glusterd/*
a3470f
+# exclude server files
a3470f
+%exclude %{_sysconfdir}/glusterfs
a3470f
+%exclude %{_sysconfdir}/glusterfs/glusterd.vol
a3470f
+%exclude %{_sysconfdir}/glusterfs/glusterfs-georep-logrotate
a3470f
+%exclude %{_sysconfdir}/glusterfs/glusterfs-logrotate
a3470f
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-5.8.conf
a3470f
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-7.2.conf
a3470f
+%exclude %{_sysconfdir}/glusterfs/group-virt.example
a3470f
+%exclude %{_sysconfdir}/glusterfs/logger.conf.example
a3470f
+%exclude %_init_glusterd
a3470f
+%exclude %{_sysconfdir}/sysconfig/glusterd
a3470f
+%exclude %{_bindir}/glusterfind
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/arbiter.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bit-rot.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bitrot-stub.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/changetimerecorder.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/index.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/leases.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/locks.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/posix*
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/snapview-server.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/marker.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quota*
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/trash.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/upcall.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt*
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/performance/decompounder.so
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server*
a3470f
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage*
a3470f
+%exclude %{_libdir}/libgfdb.so.*
a3470f
+%exclude %{_sbindir}/gcron.py
a3470f
+%exclude %{_sbindir}/glfsheal
a3470f
+%exclude %{_sbindir}/glusterd
a3470f
+%exclude %{_sbindir}/snap_scheduler.py
a3470f
+%exclude %{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
a3470f
+%if 0%{?_tmpfilesdir:1}
a3470f
+%exclude %{_tmpfilesdir}/gluster.conf
a3470f
+%endif
a3470f
+%endif
a3470f
 %doc ChangeLog COPYING-GPLV2 COPYING-LGPLV3 INSTALL README.md THANKS
a3470f
 %{_mandir}/man8/*gluster*.8*
a3470f
 %exclude %{_mandir}/man8/gluster.8*
a3470f
@@ -1044,6 +1175,11 @@ exit 0
a3470f
 %if 0%{?_tmpfilesdir:1}
a3470f
 %{_tmpfilesdir}/gluster.conf
a3470f
 %endif
a3470f
+%if ( ! 0%{?_build_server} )
a3470f
+%{_libdir}/pkgconfig/libgfchangelog.pc
a3470f
+%{_libdir}/pkgconfig/libgfdb.pc
a3470f
+%{_sbindir}/gluster-setgfid2path
a3470f
+%endif
a3470f
 
a3470f
 %files api
a3470f
 %exclude %{_libdir}/*.so
a3470f
@@ -1078,9 +1214,11 @@ exit 0
a3470f
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/debug-trace.*
a3470f
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/helloworld.*
a3470f
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/negative.*
a3470f
-%{_libdir}/pkgconfig/libgfchangelog.pc
a3470f
-%if ( 0%{!?_without_tiering:1} )
a3470f
-%{_libdir}/pkgconfig/libgfdb.pc
a3470f
+%if ( 0%{?_build_server} )
a3470f
+%exclude %{_libdir}/pkgconfig/libgfchangelog.pc
a3470f
+%exclude %{_libdir}/pkgconfig/libgfdb.pc
a3470f
+%exclude %{_sbindir}/gluster-setgfid2path
a3470f
+%exclude %{_mandir}/man8/gluster-setgfid2path.8*
a3470f
 %endif
a3470f
 
a3470f
 %files client-xlators
a3470f
@@ -1090,6 +1228,7 @@ exit 0
a3470f
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol
a3470f
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/client.so
a3470f
 
a3470f
++%if ( 0%{!?_without_extra_xlators:1} )
a3470f
 %files extra-xlators
a3470f
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
a3470f
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption
a3470f
@@ -1106,6 +1245,11 @@ exit 0
a3470f
 %dir %{python2_sitelib}/gluster
a3470f
 %dir %{python2_sitelib}/gluster/glupy
a3470f
      %{python2_sitelib}/gluster/glupy/*
a3470f
+# Don't expect a .egg-info file on EL5
a3470f
+%if ( ! ( 0%{?rhel} && 0%{?rhel} < 6 ) )
a3470f
+%{python_sitelib}/glusterfs_glupy*.egg-info
a3470f
+%endif
a3470f
+%endif
a3470f
 
a3470f
 %files fuse
a3470f
 # glusterfs is a symlink to glusterfsd, -server depends on -fuse.
a3470f
@@ -1125,6 +1269,7 @@ exit 0
a3470f
 %endif
a3470f
 %endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{?_with_gnfs:1} )
a3470f
 %files gnfs
a3470f
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
a3470f
@@ -1135,7 +1280,13 @@ exit 0
a3470f
 %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/nfs/run
a3470f
 %ghost      %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/run/nfs.pid
a3470f
 %endif
a3470f
+%endif
a3470f
+
a3470f
+%if ( 0%{?_build_server} )
a3470f
+%files ganesha
a3470f
+%endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_georeplication:1} )
a3470f
 %files geo-replication
a3470f
 %config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-georep
a3470f
@@ -1172,6 +1323,7 @@ exit 0
a3470f
      %{_datadir}/glusterfs/scripts/gsync-sync-gfid
a3470f
      %{_datadir}/glusterfs/scripts/schedule_georep.py*
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
 %files libs
a3470f
 %{_libdir}/*.so.*
a3470f
@@ -1194,19 +1346,26 @@ exit 0
a3470f
      %{_libdir}/glusterfs/%{version}%{?prereltag}/rpc-transport/rdma*
a3470f
 %endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %files regression-tests
a3470f
 %dir %{_datadir}/glusterfs
a3470f
      %{_datadir}/glusterfs/run-tests.sh
a3470f
      %{_datadir}/glusterfs/tests
a3470f
 %exclude %{_datadir}/glusterfs/tests/vagrant
a3470f
+%exclude %{_datadir}/share/glusterfs/tests/basic/rpm.t
a3470f
+%endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_ocf:1} )
a3470f
 %files resource-agents
a3470f
 # /usr/lib is the standard for OCF, also on x86_64
a3470f
 %{_prefix}/lib/ocf/resource.d/glusterfs
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %files server
a3470f
+%exclude %{_sharedstatedir}/glusterd/hooks/1/gsync-create/post/S56glusterd-geo-rep-create-post.sh
a3470f
 %doc extras/clear_xattrs.sh
a3470f
 # sysconf
a3470f
 %config(noreplace) %{_sysconfdir}/glusterfs
a3470f
@@ -1277,7 +1436,6 @@ exit 0
a3470f
 %{_sbindir}/gcron.py
a3470f
 %{_sbindir}/conf.py
a3470f
 
a3470f
-<<<<<<< 2944c7b6656a36a79551f9f9f24ab7a10467f13a
a3470f
 # /var/lib/glusterd, e.g. hookscripts, etc.
a3470f
 %ghost      %attr(0644,-,-) %config(noreplace) %{_sharedstatedir}/glusterd/glusterd.info
a3470f
        %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd
a3470f
@@ -1354,8 +1512,438 @@ exit 0
a3470f
 %if ( 0%{?_with_firewalld:1} )
a3470f
 %{_prefix}/lib/firewalld/services/glusterfs.xml
a3470f
 %endif
a3470f
+%endif
a3470f
+
a3470f
+
a3470f
+##-----------------------------------------------------------------------------
a3470f
+## All %pretrans should be placed here and keep them sorted
a3470f
+##
a3470f
+%if 0%{?_build_server}
a3470f
+%pretrans -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          echo "ERROR: Distribute volumes detected. In-service rolling upgrade requires distribute volume(s) to be stopped."
a3470f
+          echo "ERROR: Please stop distribute volume(s) before proceeding... exiting!"
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   echo "WARNING: Updating glusterfs requires its processes to be killed. This action does NOT incur downtime."
a3470f
+   echo "WARNING: Ensure to wait for the upgraded server to finish healing before proceeding."
a3470f
+   echo "WARNING: Refer upgrade section of install guide for more details"
a3470f
+   echo "Please run # service glusterd stop; pkill glusterfs; pkill glusterfsd; pkill gsyncd.py;"
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+
a3470f
+
a3470f
+
a3470f
+%pretrans api -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-api_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+
a3470f
+
a3470f
+
a3470f
+%pretrans api-devel -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-api-devel_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+
a3470f
+
a3470f
+
a3470f
+%pretrans devel -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-devel_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+
a3470f
+
a3470f
+
a3470f
+%pretrans fuse -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-fuse_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+
a3470f
+
a3470f
+
a3470f
+%if 0%{?_can_georeplicate}
a3470f
+%if ( 0%{!?_without_georeplication:1} )
a3470f
+%pretrans geo-replication -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-geo-replication_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+%endif
a3470f
+%endif
a3470f
+
a3470f
+
a3470f
+
a3470f
+%pretrans libs -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-libs_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+
a3470f
+
a3470f
+
a3470f
+%if ( 0%{!?_without_rdma:1} )
a3470f
+%pretrans rdma -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-rdma_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+%endif
a3470f
+
a3470f
+
a3470f
+
a3470f
+%if ( 0%{!?_without_ocf:1} )
a3470f
+%pretrans resource-agents -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-resource-agents_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+%endif
a3470f
+
a3470f
+
a3470f
+
a3470f
+%pretrans server -p <lua>
a3470f
+if not posix.access("/bin/bash", "x") then
a3470f
+    -- initial installation, no shell, no running glusterfsd
a3470f
+    return 0
a3470f
+end
a3470f
+
a3470f
+-- TODO: move this completely to a lua script
a3470f
+-- For now, we write a temporary bash script and execute that.
a3470f
+
a3470f
+script = [[#!/bin/sh
a3470f
+pidof -c -o %PPID -x glusterfsd &>/dev/null
a3470f
+
a3470f
+if [ $? -eq 0 ]; then
a3470f
+   pushd . > /dev/null 2>&1
a3470f
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
a3470f
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
a3470f
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
a3470f
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
a3470f
+          exit 1;
a3470f
+       fi
a3470f
+   done
a3470f
+
a3470f
+   popd > /dev/null 2>&1
a3470f
+   exit 1;
a3470f
+fi
a3470f
+]]
a3470f
+
a3470f
+-- rpm in RHEL5 does not have os.tmpname()
a3470f
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
a3470f
+tmpname = "/tmp/glusterfs-server_pretrans_" .. os.date("%s")
a3470f
+tmpfile = io.open(tmpname, "w")
a3470f
+tmpfile:write(script)
a3470f
+tmpfile:close()
a3470f
+ok, how, val = os.execute("/bin/bash " .. tmpname)
a3470f
+os.remove(tmpname)
a3470f
+if not (ok == 0) then
a3470f
+   error("Detected running glusterfs processes", ok)
a3470f
+end
a3470f
+%endif
a3470f
 
a3470f
 # Events
a3470f
+%if ( 0%{?_build_server} )
a3470f
 %if ( 0%{!?_without_events:1} )
a3470f
 %files events
a3470f
 %config(noreplace) %{_sysconfdir}/glusterfs/eventsconfig.json
a3470f
@@ -1373,6 +1961,7 @@ exit 0
a3470f
 %{_sysconfdir}/init.d/glustereventsd
a3470f
 %endif
a3470f
 %endif
a3470f
+%endif
a3470f
 
a3470f
 %changelog
a3470f
 * Tue Aug 22 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
a3470f
-- 
a3470f
1.8.3.1
a3470f