Switch to /bin/bash

Since there is no hard requirement for a strict POSIX shell
implementation, we can switch to /bin/bash.

Clean up left over break statements and consistently use $() for command
substitutions.

Original commit: elastic/x-pack-elasticsearch@0a33dfed56
This commit is contained in:
Dimitrios Liappis 2016-11-29 14:44:56 +02:00
parent 589e880a9c
commit 9294827a91
1 changed files with 11 additions and 13 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# This script is used as a single command to run the x-plugins tests.
#
# It will attempt to check out 'elasticsearch' into a sibling directory
@ -13,9 +13,7 @@
# Turn on semi-strict mode
set -e
if [ -n "$BASH" ]; then
set -o pipefail
fi
set -o pipefail
# Allow the user choose different test through a single cli arg
# default to `check` if no argument has been supplied
@ -23,12 +21,12 @@ key=${1-check}
case $key in
packagingTest)
GRADLE_OPT_STRING="--info -Pvagrant.boxes=all :x-plugins:qa:vagrant:packagingTest"
break;;
;;
check)
GRADLE_OPT_STRING="--info check -Dtests.network=true -Dtests.badapples=true"
break;;
;;
*)
echo "Unsupported cli argument $1. Allowed parameters are packagingTest or check. No argument defaults to check."
echo "Unsupported cli argument $1. Allowed arguments are packagingTest or check. No argument defaults to check."
exit 1;;
esac
@ -36,23 +34,23 @@ SCRIPT="$0"
# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
ls=$(ls -ld "$SCRIPT")
# Drop everything prior to ->
link=`expr "$ls" : '.*-> \(.*\)$'`
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
SCRIPT=$(dirname "$SCRIPT")/"$link"
fi
done
# determine base directory
BASE_DIR=`dirname "$SCRIPT"`/..
BASE_DIR=$(dirname "$SCRIPT")/..
# make BASE_DIR absolute
BASE_DIR=`cd "$BASE_DIR"; pwd`
BASE_DIR=$(cd "$BASE_DIR"; pwd)
PARENT_DIR=`cd "$BASE_DIR"/..; pwd`
PARENT_DIR=$(cd "$BASE_DIR"/..; pwd)
# go to the parent directory
cd $PARENT_DIR