Blob Blame History Raw
From 207b9db5123f4c1aaaf533ddaff907a305cfc903 Mon Sep 17 00:00:00 2001
From: Raghavendra Talur <rtalur@redhat.com>
Date: Tue, 14 Jul 2015 23:24:55 +0530
Subject: [PATCH 242/244] extras/hooks: Fix parsing of args in S30samba-set.sh

        Backport of http://review.gluster.org/#/c/11668/

Change-Id: I75756f44757a144b0ed229fcc0e29a273fc75886
BUG: 1242767
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/52988
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
---
 extras/hook-scripts/set/post/S30samba-set.sh |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/extras/hook-scripts/set/post/S30samba-set.sh b/extras/hook-scripts/set/post/S30samba-set.sh
index b8c5acf..277b7b0 100755
--- a/extras/hook-scripts/set/post/S30samba-set.sh
+++ b/extras/hook-scripts/set/post/S30samba-set.sh
@@ -28,7 +28,7 @@ USERSMB_SET=""
 USERCIFS_SET=""
 
 function parse_args () {
-        ARGS=$(getopt -l $OPTSPEC  -o "o" -name $PROGNAME $@)
+        ARGS=$(getopt -l $OPTSPEC  --name $PROGNAME -o "o:" -- $@)
         eval set -- "$ARGS"
 
         while true; do
@@ -41,10 +41,13 @@ function parse_args () {
                     shift
                     GLUSTERD_WORKDIR=$1
                     ;;
-                *)
+	        --)
                     shift
-                    for pair in $@; do
-                        read key value < <(echo "$pair" | tr "=" " ")
+                    break
+                    ;;
+                -o)
+                    shift
+                        read key value < <(echo "$1" | tr "=" " ")
                         case "$key" in
                             "user.cifs")
                                 USERCIFS_SET="YES"
@@ -55,10 +58,11 @@ function parse_args () {
                             *)
                                 ;;
                         esac
-                    done
-                    shift
-                    break
                     ;;
+		*)
+		   shift
+		   break
+		   ;;
             esac
             shift
         done
-- 
1.7.1