|
|
e3c68b |
From bf5906cbc9bf986c7495db792d098001e28c47e3 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Niels de Vos <ndevos@redhat.com>
|
|
|
e3c68b |
Date: Wed, 22 Apr 2015 15:39:59 +0200
|
|
|
e3c68b |
Subject: [PATCH 10/52] spec: fix/add pre-transaction scripts for geo-rep and
|
|
|
e3c68b |
cli packages
|
|
|
e3c68b |
|
|
|
e3c68b |
The cli subpackage never had a %pretrans script, this has been added
|
|
|
e3c68b |
now.
|
|
|
e3c68b |
|
|
|
e3c68b |
The %pretrans script for ge-repliaction was never included in the RPM
|
|
|
e3c68b |
package because it was disable by a undefined macro (_can_georeplicate).
|
|
|
e3c68b |
This macro is not used/set anywhere else and _without_georeplication
|
|
|
e3c68b |
should take care of it anyway.
|
|
|
e3c68b |
|
|
|
e3c68b |
Note: This is a Red Hat Gluster Storage specific patch. Upstream
|
|
|
e3c68b |
packaging guidelines do not allow these kind of 'features'.
|
|
|
e3c68b |
|
|
|
e3c68b |
Label: DOWNSTREAM ONLY
|
|
|
e3c68b |
|
|
|
e3c68b |
Change-Id: I16aab5bba72f1ed178f3bcac47f9d8ef767cfcef
|
|
|
e3c68b |
Signed-off-by: Niels de Vos <ndevos@redhat.com>
|
|
|
e3c68b |
Signed-off-by: Bala.FA <barumuga@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50491
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/60138
|
|
|
e3c68b |
Tested-by: Milind Changire <mchangir@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
glusterfs.spec.in | 43 +++++++++++++++++++++++++++++++++++++++++--
|
|
|
e3c68b |
1 file changed, 41 insertions(+), 2 deletions(-)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
|
|
|
e3c68b |
index 8a31a98..b70dbfc 100644
|
|
|
e3c68b |
--- a/glusterfs.spec.in
|
|
|
e3c68b |
+++ b/glusterfs.spec.in
|
|
|
e3c68b |
@@ -1626,6 +1626,47 @@ end
|
|
|
e3c68b |
|
|
|
e3c68b |
|
|
|
e3c68b |
|
|
|
e3c68b |
+%pretrans cli -p <lua>
|
|
|
e3c68b |
+if not posix.access("/bin/bash", "x") then
|
|
|
e3c68b |
+ -- initial installation, no shell, no running glusterfsd
|
|
|
e3c68b |
+ return 0
|
|
|
e3c68b |
+end
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+-- TODO: move this completely to a lua script
|
|
|
e3c68b |
+-- For now, we write a temporary bash script and execute that.
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+script = [[#!/bin/sh
|
|
|
e3c68b |
+pidof -c -o %PPID -x glusterfsd &>/dev/null
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+if [ $? -eq 0 ]; then
|
|
|
e3c68b |
+ pushd . > /dev/null 2>&1
|
|
|
e3c68b |
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
|
|
|
e3c68b |
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
|
|
|
e3c68b |
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
|
|
|
e3c68b |
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
|
|
|
e3c68b |
+ exit 1;
|
|
|
e3c68b |
+ fi
|
|
|
e3c68b |
+ done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+ popd > /dev/null 2>&1
|
|
|
e3c68b |
+ exit 1;
|
|
|
e3c68b |
+fi
|
|
|
e3c68b |
+]]
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+-- rpm in RHEL5 does not have os.tmpname()
|
|
|
e3c68b |
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
|
|
|
e3c68b |
+tmpname = "/tmp/glusterfs-cli_pretrans_" .. os.date("%s")
|
|
|
e3c68b |
+tmpfile = io.open(tmpname, "w")
|
|
|
e3c68b |
+tmpfile:write(script)
|
|
|
e3c68b |
+tmpfile:close()
|
|
|
e3c68b |
+ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
e3c68b |
+os.remove(tmpname)
|
|
|
e3c68b |
+if not (ok == 0) then
|
|
|
e3c68b |
+ error("Detected running glusterfs processes", ok)
|
|
|
e3c68b |
+end
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
%pretrans devel -p <lua>
|
|
|
e3c68b |
if not posix.access("/bin/bash", "x") then
|
|
|
e3c68b |
-- initial installation, no shell, no running glusterfsd
|
|
|
e3c68b |
@@ -1708,7 +1749,6 @@ end
|
|
|
e3c68b |
|
|
|
e3c68b |
|
|
|
e3c68b |
|
|
|
e3c68b |
-%if 0%{?_can_georeplicate}
|
|
|
e3c68b |
%if ( 0%{!?_without_georeplication:1} )
|
|
|
e3c68b |
%pretrans geo-replication -p <lua>
|
|
|
e3c68b |
if not posix.access("/bin/bash", "x") then
|
|
|
e3c68b |
@@ -1749,7 +1789,6 @@ if not (ok == 0) then
|
|
|
e3c68b |
error("Detected running glusterfs processes", ok)
|
|
|
e3c68b |
end
|
|
|
e3c68b |
%endif
|
|
|
e3c68b |
-%endif
|
|
|
e3c68b |
|
|
|
e3c68b |
|
|
|
e3c68b |
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|