Skip to content

Commit

Permalink
brew.sh: set HOMEBREW_FORCE_HOMEBREW_ON_LINUX when core repo is homeb…
Browse files Browse the repository at this point in the history
…rew-core

See Homebrew/install#571

When the install script sets as https://github.com/Homebrew/homebrew-core,
we need to use the homebrew-core bottle domain, and correctly set
the HOMEBREW_CORE_DEFAULT_GIT_REMOTE below.

This also fixes the brew doctor issue for new homebrew-core Linux installations

Warning: Suspicious https://github.com/Homebrew/linuxbrew-core git origin remote found.
The current git origin is:
  https://github.com/Homebrew/homebrew-core

With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
  git -C "/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://github.com/Homebrew/linuxbrew-core
  • Loading branch information
iMichka committed Aug 29, 2021
1 parent 6da8630 commit 80643cc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@ then
export HOMEBREW_FORCE_HOMEBREW_ON_LINUX="1"
fi

HOMEBREW_CORE_REPOSITORY_ORIGIN="$(git -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin)"

if [[ -n "${HOMEBREW_LINUX}" && "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" = "https://github.com/Homebrew/homebrew-core" ]]
then
# If the remote origin has been set to Homebrew/homebrew-core by the install script,
# then we are in the case of a new installation of brew, using Homebrew/homebrew-core as a Linux core repository.
# In that case, set HOMEBREW_FORCE_HOMEBREW_ON_LINUX=1 to set the right HOMEBREW_BOTTLE_DOMAIN below.
export HOMEBREW_FORCE_HOMEBREW_ON_LINUX="1"
fi

if [[ -n "${HOMEBREW_MACOS}" ]]
then
HOMEBREW_PRODUCT="Homebrew"
Expand Down

0 comments on commit 80643cc

Please sign in to comment.