7f4c2a
From 207b9db5123f4c1aaaf533ddaff907a305cfc903 Mon Sep 17 00:00:00 2001
7f4c2a
From: Raghavendra Talur <rtalur@redhat.com>
7f4c2a
Date: Tue, 14 Jul 2015 23:24:55 +0530
7f4c2a
Subject: [PATCH 242/244] extras/hooks: Fix parsing of args in S30samba-set.sh
7f4c2a
7f4c2a
        Backport of http://review.gluster.org/#/c/11668/
7f4c2a
7f4c2a
Change-Id: I75756f44757a144b0ed229fcc0e29a273fc75886
7f4c2a
BUG: 1242767
7f4c2a
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/52988
7f4c2a
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
7f4c2a
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
7f4c2a
---
7f4c2a
 extras/hook-scripts/set/post/S30samba-set.sh |   18 +++++++++++-------
7f4c2a
 1 files changed, 11 insertions(+), 7 deletions(-)
7f4c2a
7f4c2a
diff --git a/extras/hook-scripts/set/post/S30samba-set.sh b/extras/hook-scripts/set/post/S30samba-set.sh
7f4c2a
index b8c5acf..277b7b0 100755
7f4c2a
--- a/extras/hook-scripts/set/post/S30samba-set.sh
7f4c2a
+++ b/extras/hook-scripts/set/post/S30samba-set.sh
7f4c2a
@@ -28,7 +28,7 @@ USERSMB_SET=""
7f4c2a
 USERCIFS_SET=""
7f4c2a
 
7f4c2a
 function parse_args () {
7f4c2a
-        ARGS=$(getopt -l $OPTSPEC  -o "o" -name $PROGNAME $@)
7f4c2a
+        ARGS=$(getopt -l $OPTSPEC  --name $PROGNAME -o "o:" -- $@)
7f4c2a
         eval set -- "$ARGS"
7f4c2a
 
7f4c2a
         while true; do
7f4c2a
@@ -41,10 +41,13 @@ function parse_args () {
7f4c2a
                     shift
7f4c2a
                     GLUSTERD_WORKDIR=$1
7f4c2a
                     ;;
7f4c2a
-                *)
7f4c2a
+	        --)
7f4c2a
                     shift
7f4c2a
-                    for pair in $@; do
7f4c2a
-                        read key value < <(echo "$pair" | tr "=" " ")
7f4c2a
+                    break
7f4c2a
+                    ;;
7f4c2a
+                -o)
7f4c2a
+                    shift
7f4c2a
+                        read key value < <(echo "$1" | tr "=" " ")
7f4c2a
                         case "$key" in
7f4c2a
                             "user.cifs")
7f4c2a
                                 USERCIFS_SET="YES"
7f4c2a
@@ -55,10 +58,11 @@ function parse_args () {
7f4c2a
                             *)
7f4c2a
                                 ;;
7f4c2a
                         esac
7f4c2a
-                    done
7f4c2a
-                    shift
7f4c2a
-                    break
7f4c2a
                     ;;
7f4c2a
+		*)
7f4c2a
+		   shift
7f4c2a
+		   break
7f4c2a
+		   ;;
7f4c2a
             esac
7f4c2a
             shift
7f4c2a
         done
7f4c2a
-- 
7f4c2a
1.7.1
7f4c2a