diff --git a/scripts/configure_dev.sh b/scripts/configure_dev.sh index 474e869fbf..859eafc487 100755 --- a/scripts/configure_dev.sh +++ b/scripts/configure_dev.sh @@ -13,24 +13,30 @@ Options: FORCE=false while getopts ":sfh" opt; do - case ${opt} in - f ) FORCE=true - ;; - h ) echo "${HELP}" + case ${opt} in + f) + FORCE=true + ;; + h) + echo "${HELP}" exit 0 - ;; - \? ) echo "${HELP}" + ;; + \?) + echo "${HELP}" exit 2 - ;; - esac + ;; + esac done -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +SCRIPTPATH="$( + cd "$(dirname "$0")" + pwd -P +)" OS=$("$SCRIPTPATH"/ostype.sh) function install_or_upgrade { - if ${FORCE} ; then + if ${FORCE}; then BREW_FORCE="-f" fi if brew ls --versions "$1" >/dev/null; then @@ -43,30 +49,30 @@ function install_or_upgrade { function install_windows_shellcheck() { version="v0.7.1" if ! wget https://github.com/koalaman/shellcheck/releases/download/$version/shellcheck-$version.zip -O /tmp/shellcheck-$version.zip; then - rm /tmp/shellcheck-$version.zip &> /dev/null + rm /tmp/shellcheck-$version.zip &>/dev/null echo "Error downloading shellcheck $version" return 1 fi if ! unzip -o /tmp/shellcheck-$version.zip shellcheck-$version.exe -d /tmp; then - rm /tmp/shellcheck-$version.zip &> /dev/null + rm /tmp/shellcheck-$version.zip &>/dev/null echo "Unable to decompress shellcheck $version" return 1 fi if ! mv -f /tmp/shellcheck-$version.exe /usr/bin/shellcheck.exe; then - rm /tmp/shellcheck-$version.zip &> /dev/null + rm /tmp/shellcheck-$version.zip &>/dev/null echo "Unable to move shellcheck to /usr/bin" return 1 fi - rm /tmp/shellcheck-$version.zip &> /dev/null + rm /tmp/shellcheck-$version.zip &>/dev/null return 0 } if [ "${OS}" = "linux" ]; then - if ! which sudo > /dev/null; then + if ! which sudo >/dev/null; then "$SCRIPTPATH/install_linux_deps.sh" else sudo "$SCRIPTPATH/install_linux_deps.sh" @@ -74,7 +80,13 @@ if [ "${OS}" = "linux" ]; then elif [ "${OS}" = "darwin" ]; then if [ "${CIRCLECI}" != "true" ]; then brew update - brew tap homebrew/cask + brew_version=$(brew --version | head -1 | cut -d' ' -f2) + major_version=$(echo $brew_version | cut -d. -f1) + minor_version=$(echo $brew_version | cut -d. -f2) + version_decimal="$major_version.$minor_version" + if (($(echo "$version_decimal < 2.5" | bc -l))); then + brew tap homebrew/cask + fi fi install_or_upgrade pkg-config install_or_upgrade libtool