From eed8d83b3e0e68aebacf1b6d9b259d572273fcae Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 25 Jan 2013 17:57:12 +0000 Subject: [PATCH] We no longer support any form of long options. Fixes #28. Added missing opt strings, `-M|-N|-S`. --- .run-boostrap-tests.sh | 4 ++-- bootstrap-salt-minion.sh | 42 ++++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.run-boostrap-tests.sh b/.run-boostrap-tests.sh index 4c320b9..a326173 100755 --- a/.run-boostrap-tests.sh +++ b/.run-boostrap-tests.sh @@ -45,8 +45,8 @@ passed_echo() { title_echo "Running checkbashisms" /usr/bin/checkbashisms -pxfn bootstrap-salt-minion.sh && passed_echo || failed_echo -title_echo "Double dashed long options are errors and explained to the user" -/bin/bash bootstrap-salt-minion.sh --help | grep "Long options are NOT double-dash prefixed" && passed_echo || failed_echo +title_echo "Passing '-N'(no minion) without passing '-M'(install master) or '-S'(install syndic) fails" +./bootstrap-salt-minion.sh -N && failed_echo || passed_echo title_echo "Installing using bash" (sudo /bin/bash bootstrap-salt-minion.sh && salt-minion --versions-report && sudo apt-get remove salt-common salt-minion) && passed_echo || failed_echo diff --git a/bootstrap-salt-minion.sh b/bootstrap-salt-minion.sh index 41fd1ee..1ced3e0 100755 --- a/bootstrap-salt-minion.sh +++ b/bootstrap-salt-minion.sh @@ -45,12 +45,12 @@ usage() { $ ${ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357 Options: - -h|-help Display this message - -v|-version Display script version - -c|-config-dir Temporary minion configuration directory - -M|-master Also install salt-master - -S|-syndic Also install salt-syndic - -N|-no-minion Do not install salt-minion + -h Display this message + -v Display script version + -c Temporary minion configuration directory + -M Also install salt-master + -S Also install salt-syndic + -N Do not install salt-minion EOT } # ---------- end of function usage ---------- @@ -62,27 +62,23 @@ INSTALL_MASTER=0 INSTALL_SYNDIC=0 INSTALL_MINION=1 -while getopts ":hvc:" opt +while getopts ":hvc:MSN" opt do - case $opt in + case "${opt}" in - h|help ) usage; exit 0 ;; + h ) usage; exit 0 ;; - v|version ) echo "$0 -- Version $ScriptVersion"; exit 0 ;; - c|config-dir ) TEMP_CONFIG_DIR="$OPTARG" ;; - M|master ) INSTALL_MASTER=1 ;; - S|syndic ) INSTALL_SYNDIC=1 ;; - N|no-minion ) INSTALL_MINION=0 ;; + v ) echo "$0 -- Version $ScriptVersion"; exit 0 ;; + c ) TEMP_CONFIG_DIR="$OPTARG" ;; + M ) INSTALL_MASTER=1 ;; + S ) INSTALL_SYNDIC=1 ;; + N ) INSTALL_MINION=0 ;; - \? ) echo - if [ "$OPTARG" = "-" ]; then - echo " Long options are NOT double-dash prefixed" - else - echo " Option does not exist : $OPTARG" - fi - usage - exit 1 - ;; + \?) echo + echo " Option does not exist : $OPTARG" + usage + exit 1 + ;; esac # --- end of case --- done