Add HOMEBREW_FORCE_HOMEBREW_ON_LINUX

This serves a similar purpose to the HOMEBREW_FORCE_HOMEBREW_ORG
variable but applies to more settings.
This commit is contained in:
Mike McQuaid 2018-10-20 13:58:27 +01:00
parent 864be6d82f
commit 51af87f85f
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
5 changed files with 15 additions and 6 deletions

View File

@ -86,7 +86,6 @@ then
HOMEBREW_OS_VERSION="macOS $HOMEBREW_MACOS_VERSION"
# 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_BOTTLE_DEFAULT_DOMAIN="https://homebrew.bintray.com"
# The system Curl is too old for some modern HTTPS certificates on
# older macOS versions.
@ -114,13 +113,19 @@ else
[[ -n "$HOMEBREW_LINUX" ]] && HOMEBREW_OS_VERSION="$(lsb_release -sd 2>/dev/null)"
: "${HOMEBREW_OS_VERSION:=$(uname -r)}"
HOMEBREW_OS_USER_AGENT_VERSION="$HOMEBREW_OS_VERSION"
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://linuxbrew.bintray.com"
CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}"
HOMEBREW_CACHE="${HOMEBREW_CACHE:-${CACHE_HOME}/Homebrew}"
HOMEBREW_SYSTEM_TEMP="/tmp"
fi
if [[ -n "$HOMEBREW_MACOS" || -n "$HOMEBREW_FORCE_HOMEBREW_ON_LINUX" ]]
then
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://homebrew.bintray.com"
else
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://linuxbrew.bintray.com"
fi
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_SYSTEM_TEMP}}"
if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&

View File

@ -24,7 +24,7 @@ git() {
git_init_if_necessary() {
BREW_OFFICIAL_REMOTE="https://github.com/Homebrew/brew"
if [[ -n "$HOMEBREW_MACOS" ]] || [[ -n "$HOMEBREW_FORCE_HOMEBREW_ORG" ]]
if [[ -n "$HOMEBREW_MACOS" ]] || [[ -n "$HOMEBREW_FORCE_HOMEBREW_ON_LINUX" ]]
then
CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/homebrew-core"
else

View File

@ -1,6 +1,6 @@
class CoreTap < Tap
def default_remote
if ENV["HOMEBREW_FORCE_HOMEBREW_ORG"]
if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
"https://github.com/Homebrew/homebrew-core".freeze
else
"https://github.com/Linuxbrew/homebrew-core".freeze

View File

@ -54,7 +54,7 @@ HOMEBREW_USER_AGENT_FAKE_SAFARI =
# `HOMEBREW_BOTTLE_DEFAULT_DOMAIN` isn't set.
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = if ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"]
ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"]
elsif OS.mac?
elsif OS.mac? || ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
"https://homebrew.bintray.com".freeze
else
"https://linuxbrew.bintray.com".freeze

View File

@ -1,3 +1,7 @@
module Homebrew
DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew".freeze
DEFAULT_PREFIX = if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
"/usr/local".freeze
else
"/home/linuxbrew/.linuxbrew".freeze
end
end