From: Colin Patrick McCabe Date: Wed, 25 May 2011 01:16:08 +0000 (-0700) Subject: mkcephfs.in: print out usage if no actions given X-Git-Tag: v0.29~37 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ab01d74e9143fbffd9503e22dde408fe7af59776;p=ceph.git mkcephfs.in: print out usage if no actions given If the user didn't specify any actions, print out a usage message rather than silently exiting. Signed-off-by: Colin McCabe --- diff --git a/src/mkcephfs.in b/src/mkcephfs.in index 0e0ca6e59505..54e4352305ed 100644 --- a/src/mkcephfs.in +++ b/src/mkcephfs.in @@ -86,6 +86,8 @@ adminkeyring="" conf="" dir="" moreargs="" +auto_action=0 +manual_action=0 while [ $# -ge 1 ]; do case $1 in @@ -99,27 +101,33 @@ case $1 in ;; --allhosts | -a) allhosts=1 + auto_action=1 ;; --prepare-monmap) preparemonmap=1 + manual_action=1 ;; --prepare-osdfs) [ -z "$2" ] && usage_exit shift prepareosdfs=$1 + manual_action=1 ;; --init-daemon) [ -z "$2" ] && usage_exit shift initdaemon=$1 + manual_action=1 ;; --init-local-daemons) [ -z "$2" ] && usage_exit shift initlocaldaemons=$1 + manual_action=1 ;; --prepare-mon) preparemon=1 + manual_action=1 ;; --mkbtrfs) mkbtrfs=1 @@ -169,15 +177,16 @@ done [ -z "$conf" ] && [ -n "$dir" ] && conf="$dir/conf" -if [ $allhosts -eq 1 ]; then - if [ $preparemonmap -eq 1 ] || [ -n "$initdaemon" ] || [ -n "$initlocaldaemons" ] || [ -n "$prepareosdfs" ] || [ -n "$preparemon" ] ; then - echo "The -a option cannot be combined with other subcommands; see man page." - usage_exit +if [ $manual_action -eq 0 ]; then + if [ $auto_action -eq 0 ]; then + echo "You must specify an action. See man page." + usage_exit fi +elif [ $auto_action -eq 1 ]; then + echo "The -a option cannot be combined with other subcommands; see man page." + usage_exit fi - - ### prepare-monmap ### if [ $preparemonmap -eq 1 ]; then