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