]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/init-ceph.in: process command-line options using getopt
authorNathan Cutler <ncutler@suse.cz>
Sun, 27 Sep 2015 19:11:00 +0000 (21:11 +0200)
committerNathan Cutler <ncutler@suse.com>
Wed, 11 Nov 2015 13:10:14 +0000 (14:10 +0100)
http://tracker.ceph.com/issues/3015 Fixes: #3015

Signed-off-by: Nathan Cutler <ncutler@suse.com>
src/init-ceph.in

index faeb7bd76d6ca03e356004386d2c87bc1a891d11..f4645ef860c3d770ae0dfd2021eeb12fbe0e8b6c 100755 (executable)
@@ -109,6 +109,14 @@ stop_daemon() {
 ## command line options
 options=
 
+OPTS=$(getopt -n 'init-ceph' -o 'hvam:c:' -l 'help,verbose,valgrind,novalgrind,allhosts,restart,norestart,btrfs,nobtrfs,fsmount,nofsmount,btrfsumount,fsumount,conf:,cluster:,hostname:' -- "$@")
+if [ $? != 0 ]
+then
+    exit 1
+fi
+
+eval set -- "$OPTS"
+
 version=0
 dovalgrind=
 docrun=
@@ -141,6 +149,9 @@ case $1 in
     --norestart)
            docrun=0
            ;;
+    -h | --help)
+            usage_exit
+            ;;
     -m )
            [ -z "$2" ] && usage_exit
            options="$options $1"
@@ -175,6 +186,10 @@ case $1 in
            shift
            hostname=$1
             ;;
+    -- )
+            shift
+            break
+            ;;
     *)
            echo unrecognized option \'$1\'
            usage_exit
@@ -184,7 +199,6 @@ options="$options $1"
 shift
 done
 
-
 # if `--cluster` was not passed in, fallback to looking at the config name
 if [ -z "$cluster" ]; then
     cluster=`echo $conf | awk -F'/' '{print $(NF)}' | cut -d'.' -f 1`