extras/hooks: Fix parsing of args in S30samba-set.sh
authorRaghavendra Talur <rtalur@redhat.com>
Tue, 14 Jul 2015 17:54:55 +0000 (23:24 +0530)
committerJeff Darcy <jdarcy@redhat.com>
Mon, 16 Nov 2015 13:41:15 +0000 (05:41 -0800)
Change-Id: I75756f44757a144b0ed229fcc0e29a273fc75886
BUG: 1242892
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/11668
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
extras/hook-scripts/set/post/S30samba-set.sh

index b8c5acf4cde7e6ad6990d8ee8e78abf18de7741f..e359059992bca6e265f11d0f07f34403b18ee80a 100755 (executable)
@@ -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
+                    break
+                    ;;
+                -o)
                     shift
-                    for pair in $@; do
-                        read key value < <(echo "$pair" | tr "=" " ")
+                        read key value < <(echo "$1" | tr "=" " ")
                         case "$key" in
                             "user.cifs")
                                 USERCIFS_SET="YES"
@@ -55,7 +58,8 @@ function parse_args () {
                             *)
                                 ;;
                         esac
-                    done
+                    ;;
+                *)
                     shift
                     break
                     ;;