diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2019-08-26 15:38:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-26 15:38:04 -0700 |
commit | 9b9ecdf85954e937bd569cba018b6b09eee787a1 (patch) | |
tree | 0d28bf7f9ba77e45ffba52cfe7913f8ee566bd79 /contrib/get-win-dependencies | |
parent | bf0c04f38a1dede1560bc880193889c6dd85ad67 (diff) |
Make contrib/get-* more robust. (#3198)
We use the command which to determine if a command is available on the system. However, which is not installed on all platforms by default (e.g. CentOS). command is a shell builtin that can be used for the same purpose.
Diffstat (limited to 'contrib/get-win-dependencies')
-rwxr-xr-x | contrib/get-win-dependencies | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/get-win-dependencies b/contrib/get-win-dependencies index f3fbd6cf7..1138e3071 100755 --- a/contrib/get-win-dependencies +++ b/contrib/get-win-dependencies @@ -1,10 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash # # win32-build script # Morgan Deters <mdeters@cs.nyu.edu> # Tue, 15 Jan 2013 11:11:24 -0500 # +set -e -o pipefail + export WINDOWS_BUILD=yes export MAKE_CFLAGS= export MAKE_CXXFLAGS= @@ -50,10 +52,10 @@ function reporterror { } function webget { - if which curl &>/dev/null; then - curl -L "$1" >"$2" - elif which wget &>/dev/null; then + if [ -x "$(command -v wget)" ]; then wget -c -O "$2" "$1" + elif [ -x "$(command -v curl)" ]; then + curl -L "$1" >"$2" else echo "Can't figure out how to download from web. Please install wget or curl." >&2 exit 1 |