Allow optionally using Homebrew's curl

If `HOMEBREW_FORCE_BREWED_CURL` is set then allow it to be used instead
of the system `curl`.
This commit is contained in:
Mike McQuaid 2017-11-26 18:17:25 +00:00
parent 7f1d5903ff
commit a19d0708a4
4 changed files with 15 additions and 12 deletions

View File

@ -110,16 +110,18 @@ then
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12 # Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X $HOMEBREW_MACOS_VERSION" HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X $HOMEBREW_MACOS_VERSION"
# The system Curl is too old for some modern HTTPS certificates on
# older macOS versions.
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ } printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]] if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
then then
HOMEBREW_SYSTEM_CURL_TOO_OLD="1" HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
HOMEBREW_FORCE_BREWED_CURL="1"
fi fi
# The system Curl is too old for some modern HTTPS certificates on if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&
# older macOS versions. -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] &&
if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" && "$HOMEBREW_PREFIX/opt/curl/bin/curl" --version >/dev/null
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
then then
HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl" HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl"
fi fi

View File

@ -383,14 +383,15 @@ user account:
EOS EOS
fi fi
if ! git --version >/dev/null 2>&1 # we may want to use a Homebrew curl
then if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&
# we need a new enough curl to install git
if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
! -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] ! -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
then then
brew install curl brew install curl
fi fi
if ! git --version >/dev/null 2>&1
then
# we cannot install brewed git if homebrew/core is unavailable. # we cannot install brewed git if homebrew/core is unavailable.
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git [[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git
unset GIT_EXECUTABLE unset GIT_EXECUTABLE

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW\-CASK" "1" "October 2017" "Homebrew" "brew-cask" .TH "BREW\-CASK" "1" "November 2017" "Homebrew" "brew-cask"
. .
.SH "NAME" .SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS \fBbrew\-cask\fR \- a friendly binary installer for macOS

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW" "1" "October 2017" "Homebrew" "brew" .TH "BREW" "1" "November 2017" "Homebrew" "brew"
. .
.SH "NAME" .SH "NAME"
\fBbrew\fR \- The missing package manager for macOS \fBbrew\fR \- The missing package manager for macOS