Merge pull request #12191 from Bo98/curl-git-path
Redetermine curl and git paths where necessary
This commit is contained in:
commit
92749f9c52
@ -348,31 +348,38 @@ export USER="${USER:-$(id -un)}"
|
|||||||
# Higher depths mean this command was invoked by another Homebrew command.
|
# Higher depths mean this command was invoked by another Homebrew command.
|
||||||
export HOMEBREW_COMMAND_DEPTH="$((HOMEBREW_COMMAND_DEPTH + 1))"
|
export HOMEBREW_COMMAND_DEPTH="$((HOMEBREW_COMMAND_DEPTH + 1))"
|
||||||
|
|
||||||
# This is set by the user environment.
|
setup_curl() {
|
||||||
# shellcheck disable=SC2154
|
# This is set by the user environment.
|
||||||
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
|
# shellcheck disable=SC2154
|
||||||
"${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version &>/dev/null
|
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
|
||||||
then
|
"${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version &>/dev/null
|
||||||
HOMEBREW_CURL="${HOMEBREW_PREFIX}/opt/curl/bin/curl"
|
then
|
||||||
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_CURL_PATH}" ]]
|
HOMEBREW_CURL="${HOMEBREW_PREFIX}/opt/curl/bin/curl"
|
||||||
then
|
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_CURL_PATH}" ]]
|
||||||
HOMEBREW_CURL="${HOMEBREW_CURL_PATH}"
|
then
|
||||||
else
|
HOMEBREW_CURL="${HOMEBREW_CURL_PATH}"
|
||||||
HOMEBREW_CURL="curl"
|
else
|
||||||
fi
|
HOMEBREW_CURL="curl"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# This is set by the user environment.
|
setup_git() {
|
||||||
# shellcheck disable=SC2154
|
# This is set by the user environment.
|
||||||
if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] &&
|
# shellcheck disable=SC2154
|
||||||
"${HOMEBREW_PREFIX}/opt/git/bin/git" --version &>/dev/null
|
if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] &&
|
||||||
then
|
"${HOMEBREW_PREFIX}/opt/git/bin/git" --version &>/dev/null
|
||||||
HOMEBREW_GIT="${HOMEBREW_PREFIX}/opt/git/bin/git"
|
then
|
||||||
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_GIT_PATH}" ]]
|
HOMEBREW_GIT="${HOMEBREW_PREFIX}/opt/git/bin/git"
|
||||||
then
|
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_GIT_PATH}" ]]
|
||||||
HOMEBREW_GIT="${HOMEBREW_GIT_PATH}"
|
then
|
||||||
else
|
HOMEBREW_GIT="${HOMEBREW_GIT_PATH}"
|
||||||
HOMEBREW_GIT="git"
|
else
|
||||||
fi
|
HOMEBREW_GIT="git"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_curl
|
||||||
|
setup_git
|
||||||
|
|
||||||
HOMEBREW_VERSION="$("${HOMEBREW_GIT}" -C "${HOMEBREW_REPOSITORY}" describe --tags --dirty --abbrev=7 2>/dev/null)"
|
HOMEBREW_VERSION="$("${HOMEBREW_GIT}" -C "${HOMEBREW_REPOSITORY}" describe --tags --dirty --abbrev=7 2>/dev/null)"
|
||||||
HOMEBREW_USER_AGENT_VERSION="${HOMEBREW_VERSION}"
|
HOMEBREW_USER_AGENT_VERSION="${HOMEBREW_VERSION}"
|
||||||
@ -548,11 +555,18 @@ Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${HOMEBREW_FORCE_BREWED_CA_CERTIFICATES}" && -f "${HOMEBREW_PREFIX}/etc/ca-certificates/cert.pem" ]]
|
setup_ca_certificates() {
|
||||||
then
|
if [[ -n "${HOMEBREW_FORCE_BREWED_CA_CERTIFICATES}" && -f "${HOMEBREW_PREFIX}/etc/ca-certificates/cert.pem" ]]
|
||||||
export SSL_CERT_FILE="${HOMEBREW_PREFIX}/etc/ca-certificates/cert.pem"
|
then
|
||||||
export GIT_SSL_CAINFO="${HOMEBREW_PREFIX}/etc/ca-certificates/cert.pem"
|
export SSL_CERT_FILE="${HOMEBREW_PREFIX}/etc/ca-certificates/cert.pem"
|
||||||
fi
|
export GIT_SSL_CAINFO="${HOMEBREW_PREFIX}/etc/ca-certificates/cert.pem"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
setup_ca_certificates
|
||||||
|
|
||||||
|
# Redetermine curl and git paths as we may have forced some options above.
|
||||||
|
setup_curl
|
||||||
|
setup_git
|
||||||
|
|
||||||
# A bug in the auto-update process prior to 3.1.2 means $HOMEBREW_BOTTLE_DOMAIN
|
# A bug in the auto-update process prior to 3.1.2 means $HOMEBREW_BOTTLE_DOMAIN
|
||||||
# could be passed down with the default domain.
|
# could be passed down with the default domain.
|
||||||
|
|||||||
@ -390,6 +390,7 @@ EOS
|
|||||||
if [[ -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" || -n "${HOMEBREW_INSTALL_FROM_API}" ]]
|
if [[ -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" || -n "${HOMEBREW_INSTALL_FROM_API}" ]]
|
||||||
then
|
then
|
||||||
brew install ca-certificates
|
brew install ca-certificates
|
||||||
|
setup_ca_certificates
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -401,6 +402,8 @@ EOS
|
|||||||
then
|
then
|
||||||
odie "'curl' must be installed and in your PATH!"
|
odie "'curl' must be installed and in your PATH!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_curl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! git --version &>/dev/null ||
|
if ! git --version &>/dev/null ||
|
||||||
@ -411,6 +414,8 @@ EOS
|
|||||||
then
|
then
|
||||||
odie "'git' must be installed and in your PATH!"
|
odie "'git' must be installed and in your PATH!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1
|
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user