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