brew.sh: set HOMEBREW_CELLAR after default prefix

Fixes #14557. This allows correcting the prefix variables first. See #15656.

Co-Authored-By: rohanssrao <17805516+rohanssrao@users.noreply.github.com>
This commit is contained in:
Osama Albahrani 2023-07-08 21:55:26 -04:00
parent 4bbc0af693
commit 287a359a74
2 changed files with 12 additions and 12 deletions

View File

@ -13,17 +13,6 @@ case "${HOMEBREW_SYSTEM}" in
Linux) HOMEBREW_LINUX="1" ;;
esac
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
# These variables are set by bin/brew
# shellcheck disable=SC2154
if [[ -d "${HOMEBREW_REPOSITORY}/Cellar" ]]
then
HOMEBREW_CELLAR="${HOMEBREW_REPOSITORY}/Cellar"
else
HOMEBREW_CELLAR="${HOMEBREW_PREFIX}/Cellar"
fi
HOMEBREW_MACOS_ARM_DEFAULT_PREFIX="/opt/homebrew"
HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY="${HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}"
HOMEBREW_LINUX_DEFAULT_PREFIX="/home/linuxbrew/.linuxbrew"
@ -55,6 +44,17 @@ else
HOMEBREW_DEFAULT_TEMP="/tmp"
fi
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
# These variables are set by bin/brew
# shellcheck disable=SC2154
if [[ -d "${HOMEBREW_REPOSITORY}/Cellar" ]]
then
HOMEBREW_CELLAR="${HOMEBREW_REPOSITORY}/Cellar"
else
HOMEBREW_CELLAR="${HOMEBREW_PREFIX}/Cellar"
fi
HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"

View File

@ -40,7 +40,7 @@ do
done
unset cmd
BREW_FILE_DIRECTORY="$(quiet_cd "${0%/*}/" && pwd -P)"
BREW_FILE_DIRECTORY="$(quiet_cd "${0%/*}/" && pwd)"
HOMEBREW_BREW_FILE="${BREW_FILE_DIRECTORY%/}/${0##*/}"
HOMEBREW_PREFIX="${HOMEBREW_BREW_FILE%/*/*}"