create new envoronments
This commit is contained in:
parent
1c9e30e24f
commit
e6e0d1128c
@ -251,6 +251,8 @@ export HOMEBREW_MACOS_VERSION_NUMERIC
|
||||
export HOMEBREW_USER_AGENT
|
||||
export HOMEBREW_USER_AGENT_CURL
|
||||
export HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
||||
export HOMEBREW_BREW_REMOTE
|
||||
export HOMEBREW_DEFAULT_CORE_REMOTE
|
||||
|
||||
if [[ -n "$HOMEBREW_MACOS" && -x "/usr/bin/xcode-select" ]]
|
||||
then
|
||||
@ -374,6 +376,19 @@ then
|
||||
export HOMEBREW_BOTTLE_DOMAIN="$HOMEBREW_BOTTLE_DEFAULT_DOMAIN"
|
||||
fi
|
||||
|
||||
HOMEBREW_DEFAULT_BREW_REMOTE="https://github.com/Homebrew/brew.git"
|
||||
if [[ -z "$HOMEBREW_BREW_REMOTE" ]]
|
||||
then
|
||||
HOMEBREW_BREW_REMOTE="$HOMEBREW_DEFAULT_BREW_REMOTE"
|
||||
fi
|
||||
|
||||
if [[ -n "$HOMEBREW_MACOS" ]] || [[ -n "$HOMEBREW_FORCE_HOMEBREW_ON_LINUX" ]]
|
||||
then
|
||||
HOMEBREW_DEFAULT_CORE_REMOTE="https://github.com/Homebrew/homebrew-core"
|
||||
else
|
||||
HOMEBREW_DEFAULT_CORE_REMOTE="https://github.com/Homebrew/linuxbrew-core"
|
||||
fi
|
||||
|
||||
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
|
||||
then
|
||||
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"
|
||||
|
||||
@ -23,14 +23,6 @@ git() {
|
||||
}
|
||||
|
||||
git_init_if_necessary() {
|
||||
BREW_OFFICIAL_REMOTE="https://github.com/Homebrew/brew"
|
||||
if [[ -n "$HOMEBREW_MACOS" ]] || [[ -n "$HOMEBREW_FORCE_HOMEBREW_ON_LINUX" ]]
|
||||
then
|
||||
CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/homebrew-core"
|
||||
else
|
||||
CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/linuxbrew-core"
|
||||
fi
|
||||
|
||||
safe_cd "$HOMEBREW_REPOSITORY"
|
||||
if [[ ! -d ".git" ]]
|
||||
then
|
||||
@ -38,7 +30,7 @@ git_init_if_necessary() {
|
||||
trap '{ rm -rf .git; exit 1; }' EXIT
|
||||
git init
|
||||
git config --bool core.autocrlf false
|
||||
git config remote.origin.url "$BREW_OFFICIAL_REMOTE"
|
||||
git config remote.origin.url "$HOMEBREW_BREW_REMOTE"
|
||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
|
||||
git fetch --force origin --shallow-since="$latest_tag"
|
||||
@ -56,7 +48,7 @@ git_init_if_necessary() {
|
||||
trap '{ rm -rf .git; exit 1; }' EXIT
|
||||
git init
|
||||
git config --bool core.autocrlf false
|
||||
git config remote.origin.url "$CORE_OFFICIAL_REMOTE"
|
||||
git config remote.origin.url "$HOMEBREW_CORE_REMOTE"
|
||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
|
||||
git reset --hard origin/master
|
||||
@ -402,6 +394,24 @@ EOS
|
||||
|
||||
git_init_if_necessary
|
||||
|
||||
if [[ "$HOMEBREW_DEFAULT_BREW_REMOTE" != "$HOMEBREW_BREW_REMOTE" ]]
|
||||
then
|
||||
safe_cd "$HOMEBREW_REPOSITORY"
|
||||
git remote set-url origin "$HOMEBREW_BREW_REMOTE"
|
||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
|
||||
git fetch --force origin --shallow-since="$latest_tag"
|
||||
fi
|
||||
|
||||
if [[ "$HOMEBREW_DEFAULT_CORE_REMOTE" != "$HOMEBREW_CORE_REMOTE" ]] &&
|
||||
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]]
|
||||
then
|
||||
safe_cd "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core"
|
||||
git remote set-url origin "$HOMEBREW_CORE_REMOTE"
|
||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
|
||||
fi
|
||||
|
||||
safe_cd "$HOMEBREW_REPOSITORY"
|
||||
|
||||
# if an older system had a newer curl installed, change each repo's remote URL from GIT to HTTPS
|
||||
@ -409,8 +419,8 @@ EOS
|
||||
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" &&
|
||||
"$(git config remote.origin.url)" =~ ^git:// ]]
|
||||
then
|
||||
git config remote.origin.url "$BREW_OFFICIAL_REMOTE"
|
||||
git config -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/config" remote.origin.url "$CORE_OFFICIAL_REMOTE"
|
||||
git config remote.origin.url "$HOMEBREW_BREW_REMOTE"
|
||||
git config -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/config" remote.origin.url "$HOMEBREW_CORE_REMOTE"
|
||||
fi
|
||||
|
||||
# kill all of subprocess on interrupt
|
||||
|
||||
@ -113,7 +113,7 @@ module Homebrew
|
||||
return if !Utils.git_available? || !repository_path.git?
|
||||
|
||||
current_origin = repository_path.git_origin
|
||||
|
||||
user_origins = [HOMEBREW_BREW_REMOTE, HOMEBREW_CORE_REMOTE]
|
||||
if current_origin.nil?
|
||||
<<~EOS
|
||||
Missing #{desired_origin} git origin remote.
|
||||
@ -122,7 +122,8 @@ module Homebrew
|
||||
properly. You can solve this by adding the remote:
|
||||
git -C "#{repository_path}" remote add origin #{Formatter.url("https://github.com/#{desired_origin}.git")}
|
||||
EOS
|
||||
elsif !current_origin.match?(%r{#{desired_origin}(\.git|/)?$}i)
|
||||
elsif !current_origin.match?(%r{#{desired_origin}(\.git|/)?$}i) && \
|
||||
!user_origins.include?(current_origin)
|
||||
<<~EOS
|
||||
Suspicious #{desired_origin} git origin remote found.
|
||||
The current git origin is:
|
||||
|
||||
@ -53,6 +53,9 @@ HOMEBREW_USER_AGENT_FAKE_SAFARI =
|
||||
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"]
|
||||
HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"]
|
||||
|
||||
HOMEBREW_BREW_REMOTE = ENV["HOMEBREW_BREW_REMOTE"]
|
||||
HOMEBREW_CORE_REMOTE = ENV["HOMEBREW_CORE_REMOTE"]
|
||||
|
||||
HOMEBREW_DEFAULT_PREFIX = "/usr/local"
|
||||
LINUXBREW_DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user