Restore handling of HOMEBREW_BREW_WRAPPER
This now requires `HOMEBREW_DISABLE_NO_FORCE_BREW_WRAPPER` to be unset. If it is set (but only in a `brew.env` file), then we use the new functionality of checking the path of the parent process.
This commit is contained in:
parent
144c7f6edf
commit
b7d8072575
@ -190,10 +190,54 @@ esac
|
||||
# Include some helper functions.
|
||||
source "${HOMEBREW_LIBRARY}/Homebrew/utils/helpers.sh"
|
||||
|
||||
# If HOMEBREW_FORCE_BREW_WRAPPER is set, verify that the path to our parent
|
||||
# process is the same as the value of HOMEBREW_FORCE_BREW_WRAPPER for all
|
||||
# Require HOMEBREW_BREW_WRAPPER to be set if HOMEBREW_FORCE_BREW_WRAPPER is set
|
||||
# (and HOMEBREW_NO_FORCE_BREW_WRAPPER and HOMEBREW_DISABLE_NO_FORCE_BREW_WRAPPER are not set)
|
||||
# for all non-trivial commands (i.e. not defined above this line e.g. formulae or --cellar).
|
||||
if [[ -z "${HOMEBREW_NO_FORCE_BREW_WRAPPER:-}" && -n "${HOMEBREW_FORCE_BREW_WRAPPER:-}" &&
|
||||
-z "${HOMEBREW_DISABLE_NO_FORCE_BREW_WRAPPER:-}" ]]
|
||||
then
|
||||
HOMEBREW_FORCE_BREW_WRAPPER_WITHOUT_BREW="${HOMEBREW_FORCE_BREW_WRAPPER%/brew}"
|
||||
if [[ -z "${HOMEBREW_BREW_WRAPPER:-}" ]]
|
||||
then
|
||||
# HOMEBREW_ORIGINAL_BREW_FILE set by bin/brew
|
||||
# shellcheck disable=SC2154
|
||||
odie <<EOS
|
||||
conflicting Homebrew wrapper configuration!
|
||||
HOMEBREW_FORCE_BREW_WRAPPER was set to ${HOMEBREW_FORCE_BREW_WRAPPER}
|
||||
but HOMEBREW_BREW_WRAPPER was unset.
|
||||
|
||||
$(bold "Ensure you run ${HOMEBREW_FORCE_BREW_WRAPPER} directly (not ${HOMEBREW_ORIGINAL_BREW_FILE})")!
|
||||
|
||||
Manually setting your PATH can interfere with Homebrew wrappers.
|
||||
Ensure your shell configuration contains:
|
||||
eval "\$(${HOMEBREW_BREW_FILE} shellenv)"
|
||||
or that ${HOMEBREW_FORCE_BREW_WRAPPER_WITHOUT_BREW} comes before ${HOMEBREW_PREFIX}/bin in your PATH:
|
||||
export PATH="${HOMEBREW_FORCE_BREW_WRAPPER_WITHOUT_BREW}:${HOMEBREW_PREFIX}/bin:\$PATH"
|
||||
EOS
|
||||
elif [[ "${HOMEBREW_FORCE_BREW_WRAPPER}" != "${HOMEBREW_BREW_WRAPPER}" ]]
|
||||
then
|
||||
# HOMEBREW_ORIGINAL_BREW_FILE set by bin/brew
|
||||
# shellcheck disable=SC2154
|
||||
odie <<EOS
|
||||
conflicting Homebrew wrapper configuration!
|
||||
HOMEBREW_FORCE_BREW_WRAPPER was set to ${HOMEBREW_FORCE_BREW_WRAPPER}
|
||||
but HOMEBREW_BREW_WRAPPER was set to ${HOMEBREW_BREW_WRAPPER}
|
||||
|
||||
$(bold "Ensure you run ${HOMEBREW_FORCE_BREW_WRAPPER} directly (not ${HOMEBREW_ORIGINAL_BREW_FILE})")!
|
||||
|
||||
Manually setting your PATH can interfere with Homebrew wrappers.
|
||||
Ensure your shell configuration contains:
|
||||
eval "\$(${HOMEBREW_BREW_FILE} shellenv)"
|
||||
or that ${HOMEBREW_FORCE_BREW_WRAPPER_WITHOUT_BREW} comes before ${HOMEBREW_PREFIX}/bin in your PATH:
|
||||
export PATH="${HOMEBREW_FORCE_BREW_WRAPPER_WITHOUT_BREW}:${HOMEBREW_PREFIX}/bin:\$PATH"
|
||||
EOS
|
||||
fi
|
||||
fi
|
||||
|
||||
# If HOMEBREW_FORCE_BREW_WRAPPER and HOMEBREW_DISABLE_NO_FORCE_BREW_WRAPPER are set,
|
||||
# verify that the path to our parent process is the same as the value of HOMEBREW_FORCE_BREW_WRAPPER for all
|
||||
# non-trivial commands (i.e. not defined above this line e.g. formulae or --cellar).
|
||||
if [[ -n "${HOMEBREW_FORCE_BREW_WRAPPER:-}" ]]
|
||||
if [[ -n "${HOMEBREW_FORCE_BREW_WRAPPER:-}" && -n "${HOMEBREW_DISABLE_NO_FORCE_BREW_WRAPPER:-}" ]]
|
||||
then
|
||||
if [[ -n "${HOMEBREW_MACOS:-}" ]]
|
||||
then
|
||||
|
Loading…
x
Reference in New Issue
Block a user