Use hash to check for curl

Our shebang is Bash.
This commit is contained in:
Andrew Schwartzmeyer committed 2016-09-02 17:17:20 -07:00
1 parent 0c4472e889
commit e3cf257a7d
1 file changed
+8 -5
+8 -5
View File
@@ -20,13 +20,19 @@ case "$OSTYPE" in
# Install curl and wget to download package # Install curl and wget to download package
case "$ID" in case "$ID" in
centos*) centos*)
if [[ -z $(command -v curl) ]]; then if ! hash curl 2>/dev/null; then
echo "curl not found, installing..." echo "curl not found, installing..."
sudo yum install -y curl sudo yum install -y curl
fi fi
version=rpm version=rpm
;; ;;
ubuntu) ubuntu)
if ! hash curl 2>/dev/null; then
echo "curl not found, installing..."
sudo apt-get install -y curl
fi
case "$VERSION_ID" in case "$VERSION_ID" in
14.04) 14.04)
version=ubuntu1.14.04.1_amd64.deb version=ubuntu1.14.04.1_amd64.deb
@@ -38,10 +44,6 @@ case "$OSTYPE" in
echo "Ubuntu $VERSION_ID is not supported!" >&2 echo "Ubuntu $VERSION_ID is not supported!" >&2
exit 2 exit 2
esac 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 echo "$NAME is not supported!" >&2
@@ -49,6 +51,7 @@ case "$OSTYPE" in
esac esac
;; ;;
darwin*) darwin*)
# We don't check for curl as macOS should have a system version
version=pkg version=pkg
;; ;;
*) *)