extras/hooks: Fix getopt usage

`getopt` does not have an optional argument as '-name'. It should
be either '-n' or '--name'(see man getopt(1)). This wrong usage
resulted in setting the script name as 'ame' instead of $PROGNAME
in most of the hook-scripts.

Additionally the following line from DESCRIPTION given for `getopt`
shell command expects short options for almost every kind of usage
mentioned in SYNOPSIS:

. . .
If  no  '-o'  or '--options' option is found in the first part, the
first parameter of the second part is used as the short options string.
. . .

Refer http://man7.org/linux/man-pages/man1/getopt.1.html for more
clarity on its usage.

Change-Id: I95baf5fa8c99025e66b2d83656dd838d4f6048ce
BUG: 1503983
Signed-off-by: Anoop C S <anoopcs@redhat.com>
This commit is contained in:
Anoop C S 2017-10-19 13:40:35 +05:30 committed by Jeff Darcy
parent 9aa574a51b
commit 39ac511a5d
9 changed files with 9 additions and 9 deletions

View File

@ -74,7 +74,7 @@ get_and_set_xattr ()
##------------------------------------------
## Parse the arguments
##------------------------------------------
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true;

View File

@ -38,7 +38,7 @@ activate ()
##------------------------------------------
## Parse the arguments
##------------------------------------------
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true;

View File

@ -14,7 +14,7 @@ OPTSPEC="volname:"
VOL=
parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do

View File

@ -15,7 +15,7 @@ OPTSPEC="volname:"
VOL=
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do

View File

@ -28,7 +28,7 @@ USERSMB_SET=""
USERCIFS_SET=""
function parse_args () {
ARGS=$(getopt -l $OPTSPEC --name $PROGNAME -o "o:" -- "$@")
ARGS=$(getopt -o 'o:' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do

View File

@ -21,7 +21,7 @@ VOL=
META="all"
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do

View File

@ -29,7 +29,7 @@ PIDDIR=
GLUSTERD_WORKDIR=
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do

View File

@ -12,7 +12,7 @@ VOL=
META="all"
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do

View File

@ -22,7 +22,7 @@ CONFIGFILE=
PIDDIR=
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do