74b1de
From 7744475550cd27f58f536741e9c50c639d3b02d8 Mon Sep 17 00:00:00 2001
d1681e
From: "Bala.FA" <barumuga@redhat.com>
74b1de
Date: Thu, 6 Dec 2018 20:06:27 +0530
74b1de
Subject: [PATCH 07/52] build: add RHGS specific changes
cb8e9e
cb8e9e
Label: DOWNSTREAM ONLY
cb8e9e
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1074947
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1097782
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115267
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1221743
cb8e9e
Change-Id: I08333334745adf2350e772c6454ffcfe9c08cb89
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/24983
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/25451
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/25518
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/25983
cb8e9e
Signed-off-by: Bala.FA <barumuga@redhat.com>
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/60134
12a457
Tested-by: Milind Changire <mchangir@redhat.com>
cb8e9e
---
74b1de
 glusterfs.spec.in | 485 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
74b1de
 1 file changed, 481 insertions(+), 4 deletions(-)
cb8e9e
cb8e9e
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
74b1de
index 6be492e..eb04491 100644
cb8e9e
--- a/glusterfs.spec.in
cb8e9e
+++ b/glusterfs.spec.in
74b1de
@@ -95,9 +95,16 @@
74b1de
 %{?_without_server:%global _without_server --without-server}
cb8e9e
 
74b1de
 # disable server components forcefully as rhel <= 6
74b1de
-%if ( 0%{?rhel} && 0%{?rhel} <= 6 )
74b1de
+%if ( 0%{?rhel} )
cb8e9e
+%if ( "%{?dist}" == ".el6rhs" ) || ( "%{?dist}" == ".el7rhs" ) || ( "%{?dist}" == ".el7rhgs" )
74b1de
+%global _without_server %{nil}
cb8e9e
+%else
74b1de
 %global _without_server --without-server
74b1de
 %endif
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+%global _without_extra_xlators 1
cb8e9e
+%global _without_regression_tests 1
74b1de
 
74b1de
 # syslog
74b1de
 # if you wish to build rpms without syslog logging, compile like this
74b1de
@@ -229,7 +236,8 @@ Release:          0.1%{?prereltag:.%{prereltag}}%{?dist}
cb8e9e
 %else
cb8e9e
 Name:             @PACKAGE_NAME@
cb8e9e
 Version:          @PACKAGE_VERSION@
cb8e9e
-Release:          0.@PACKAGE_RELEASE@%{?dist}
cb8e9e
+Release:          @PACKAGE_RELEASE@%{?dist}
74b1de
+ExcludeArch:      i686
cb8e9e
 %endif
cb8e9e
 License:          GPLv2 or LGPLv3+
74b1de
 URL:              http://docs.gluster.org/
74b1de
@@ -243,8 +251,6 @@ Source8:          glusterfsd.init
74b1de
 Source0:          @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz
74b1de
 %endif
74b1de
 
74b1de
-BuildRoot:        %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
74b1de
-
74b1de
 Requires(pre):    shadow-utils
74b1de
 %if ( 0%{?_with_systemd:1} )
74b1de
 BuildRequires:    systemd
74b1de
@@ -384,7 +390,9 @@ This package provides cloudsync plugins for archival feature.
74b1de
 Summary:          Development Libraries
12a457
 Requires:         %{name}%{?_isa} = %{version}-%{release}
cb8e9e
 # Needed for the Glupy examples to work
cb8e9e
+%if ( 0%{!?_without_extra_xlators:1} )
74b1de
 Requires:         %{name}-extra-xlators%{?_isa} = %{version}-%{release}
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %description devel
cb8e9e
 GlusterFS is a distributed file-system capable of scaling to several
74b1de
@@ -397,6 +405,7 @@ is in user space and easily manageable.
cb8e9e
 
cb8e9e
 This package provides the development libraries and include files.
cb8e9e
 
cb8e9e
+%if ( 0%{!?_without_extra_xlators:1} )
cb8e9e
 %package extra-xlators
cb8e9e
 Summary:          Extra Gluster filesystem Translators
74b1de
 # We need python-gluster rpm for gluster module's __init__.py in Python
74b1de
@@ -415,6 +424,7 @@ is in user space and easily manageable.
cb8e9e
 
cb8e9e
 This package provides extra filesystem Translators, such as Glupy,
cb8e9e
 for GlusterFS.
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %package fuse
cb8e9e
 Summary:          Fuse client
74b1de
@@ -440,6 +450,30 @@ is in user space and easily manageable.
cb8e9e
 This package provides support to FUSE based clients and inlcudes the
cb8e9e
 glusterfs(d) binary.
cb8e9e
 
74b1de
+%if ( 0%{!?_without_server:1} )
d1681e
+%package ganesha
d1681e
+Summary:          NFS-Ganesha configuration
d1681e
+Group:            Applications/File
d1681e
+
d1681e
+Requires:         %{name}-server%{?_isa} = %{version}-%{release}
d1681e
+Requires:         nfs-ganesha-gluster, pcs, dbus
d1681e
+%if ( 0%{?rhel} && 0%{?rhel} == 6 )
d1681e
+Requires:         cman, pacemaker, corosync
cb8e9e
+%endif
d1681e
+
d1681e
+%description ganesha
d1681e
+GlusterFS is a distributed file-system capable of scaling to several
d1681e
+petabytes. It aggregates various storage bricks over Infiniband RDMA
d1681e
+or TCP/IP interconnect into one large parallel network file
d1681e
+system. GlusterFS is one of the most sophisticated file systems in
d1681e
+terms of features and extensibility.  It borrows a powerful concept
d1681e
+called Translators from GNU Hurd kernel. Much of the code in GlusterFS
d1681e
+is in user space and easily manageable.
d1681e
+
d1681e
+This package provides the configuration and related files for using
d1681e
+NFS-Ganesha as the NFS server using GlusterFS
d1681e
+%endif
d1681e
+
cb8e9e
 %if ( 0%{!?_without_georeplication:1} )
cb8e9e
 %package geo-replication
cb8e9e
 Summary:          GlusterFS Geo-replication
74b1de
@@ -541,6 +575,7 @@ is in user space and easily manageable.
cb8e9e
 This package provides support to ib-verbs library.
cb8e9e
 %endif
cb8e9e
 
cb8e9e
+%if ( 0%{!?_without_regression_tests:1} )
cb8e9e
 %package regression-tests
cb8e9e
 Summary:          Development Tools
74b1de
 Requires:         %{name}%{?_isa} = %{version}-%{release}
74b1de
@@ -556,6 +591,7 @@ Requires:         nfs-utils xfsprogs yajl psmisc bc
cb8e9e
 %description regression-tests
cb8e9e
 The Gluster Test Framework, is a suite of scripts used for
cb8e9e
 regression testing of Gluster.
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %if ( 0%{!?_without_ocf:1} )
cb8e9e
 %package resource-agents
74b1de
@@ -1092,6 +1128,16 @@ exit 0
74b1de
 %if 0%{?_tmpfilesdir:1} && 0%{!?_without_server:1}
74b1de
 %{_tmpfilesdir}/gluster.conf
cb8e9e
 %endif
74b1de
+%if ( 0%{?_without_extra_xlators:1} )
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quiesce.so
74b1de
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/playground/template.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance/symlink-cache.so
cb8e9e
+%endif
74b1de
+%if ( 0%{?_without_regression_tests:1} )
74b1de
+%exclude %{_datadir}/glusterfs/run-tests.sh
74b1de
+%exclude %{_datadir}/glusterfs/tests
d1681e
+%endif
d1681e
 
d1681e
 %files api
d1681e
 %exclude %{_libdir}/*.so
74b1de
@@ -1134,12 +1180,14 @@ exit 0
d1681e
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol
d1681e
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/client.so
cb8e9e
 
74b1de
+%if ( 0%{!?_without_extra_xlators:1} )
cb8e9e
 %files extra-xlators
d1681e
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
74b1de
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features
74b1de
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quiesce.so
74b1de
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/playground
74b1de
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/playground/template.so
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %files fuse
cb8e9e
 # glusterfs is a symlink to glusterfsd, -server depends on -fuse.
74b1de
@@ -1239,11 +1287,13 @@ exit 0
d1681e
      %{_libdir}/glusterfs/%{version}%{?prereltag}/rpc-transport/rdma*
cb8e9e
 %endif
cb8e9e
 
74b1de
+%if ( 0%{!?_without_regression_tests:1} )
cb8e9e
 %files regression-tests
d1681e
 %dir %{_datadir}/glusterfs
d1681e
      %{_datadir}/glusterfs/run-tests.sh
d1681e
      %{_datadir}/glusterfs/tests
d1681e
 %exclude %{_datadir}/glusterfs/tests/vagrant
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %if ( 0%{!?_without_ocf:1} )
cb8e9e
 %files resource-agents
74b1de
@@ -1424,6 +1474,433 @@ exit 0
cb8e9e
 %endif
12a457
 %endif
74b1de
 
cb8e9e
+##-----------------------------------------------------------------------------
cb8e9e
+## All %pretrans should be placed here and keep them sorted
cb8e9e
+##
74b1de
+%if 0%{!?_without_server:1}
cb8e9e
+%pretrans -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          echo "ERROR: Distribute volumes detected. In-service rolling upgrade requires distribute volume(s) to be stopped."
cb8e9e
+          echo "ERROR: Please stop distribute volume(s) before proceeding... exiting!"
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   echo "WARNING: Updating glusterfs requires its processes to be killed. This action does NOT incur downtime."
cb8e9e
+   echo "WARNING: Ensure to wait for the upgraded server to finish healing before proceeding."
cb8e9e
+   echo "WARNING: Refer upgrade section of install guide for more details"
cb8e9e
+   echo "Please run # service glusterd stop; pkill glusterfs; pkill glusterfsd; pkill gsyncd.py;"
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans api -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
12a457
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-api_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans api-devel -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-api-devel_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans devel -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-devel_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans fuse -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-fuse_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%if 0%{?_can_georeplicate}
cb8e9e
+%if ( 0%{!?_without_georeplication:1} )
cb8e9e
+%pretrans geo-replication -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-geo-replication_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans libs -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-libs_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%if ( 0%{!?_without_rdma:1} )
cb8e9e
+%pretrans rdma -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-rdma_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%if ( 0%{!?_without_ocf:1} )
cb8e9e
+%pretrans resource-agents -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-resource-agents_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans server -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-server_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
74b1de
+
cb8e9e
 %changelog
74b1de
 * Wed Mar 6 2019 Kaleb S. KEITHLEY <kkeithle@redhat.com>
74b1de
 - remove unneeded ldconfig in scriptlets
cb8e9e
-- 
d1681e
1.8.3.1
cb8e9e