From ab01d74e9143fbffd9503e22dde408fe7af59776 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Tue, 24 May 2011 18:16:08 -0700 Subject: [PATCH] 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 --- src/mkcephfs.in | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mkcephfs.in b/src/mkcephfs.in index 0e0ca6e595054..54e4352305ed9 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 -- 2.39.5