Comment 0 for bug 1463468

Revision history for this message
Albert White (albertw) wrote :

in install_rally.sh we do

set -e
...
args=$(getopt --name "$PROG" --shell sh -l "$long_opts" -o "$short_opts" -- "$@")
    if [ $? -ne 0 ]; then
...

set -r instructs the shell to exit when a command returns a non zero error code so if getopt fails we never make it into the if conditions to proceed.

A solution is to allow shell commands to give non zero return codes around this piece of code:

diff --git a/install_rally.sh b/install_rally.sh
index 1f15fd3..d606d4c 100755
--- a/install_rally.sh
+++ b/install_rally.sh
@@ -460,6 +460,7 @@ setup_rally_configuration () {
 short_opts='d:vfsyhD:p:'
 long_opts='target:,verbose,overwrite,system,yes,dbtype:,python:,db-user:,db-password:,db-host:,db-name:,help'

+set +e
 if [ "x$(getopt -T)" = 'x' ]; then
     # GNU getopt
     args=$(getopt --name "$PROG" --shell sh -l "$long_opts" -o "$short_opts" -- "$@")
@@ -472,10 +473,11 @@ else
     # old-style getopt, use compatibility syntax
     args=$(getopt "$short_opts" "$@")
     if [ $? -ne 0 ]; then
- abort 1 "Type '$PROG --help' to get usage information."
+ abort 1 "Type '$PROG -h' to get usage information."
     fi
     eval set -- "$args"
 fi
+set -e

 # Command line parsing
 while true