From e3cf257a7d92b8e8ea863d5aa7c4f58c90a94251 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 2 Sep 2016 14:44:19 -0700 Subject: [PATCH] Use hash to check for curl Our shebang is Bash. --- tools/download.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/download.sh b/tools/download.sh index fb3e6831e6..5694e9acce 100755 --- a/tools/download.sh +++ b/tools/download.sh @@ -20,13 +20,19 @@ case "$OSTYPE" in # Install curl and wget to download package case "$ID" in centos*) - if [[ -z $(command -v curl) ]]; then + if ! hash curl 2>/dev/null; then echo "curl not found, installing..." sudo yum install -y curl fi + version=rpm ;; ubuntu) + if ! hash curl 2>/dev/null; then + echo "curl not found, installing..." + sudo apt-get install -y curl + fi + case "$VERSION_ID" in 14.04) version=ubuntu1.14.04.1_amd64.deb @@ -38,10 +44,6 @@ case "$OSTYPE" in echo "Ubuntu $VERSION_ID is not supported!" >&2 exit 2 esac - if [[ -z $(command -v curl) ]]; then - echo "curl not found, installing..." - sudo apt-get install -y curl - fi ;; *) echo "$NAME is not supported!" >&2 @@ -49,6 +51,7 @@ case "$OSTYPE" in esac ;; darwin*) + # We don't check for curl as macOS should have a system version version=pkg ;; *)