From f999a57620d761065415bcd2d2a4141208a96eb9 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 4 Nov 2017 16:30:54 +0000 Subject: [PATCH] brew.sh: cleanup some environment pollution. --- Library/Homebrew/brew.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 241fa1c2e8..1e2b0f3ed8 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -69,9 +69,15 @@ then odie "Cowardly refusing to continue at this prefix: $HOMEBREW_PREFIX" fi -# Save value to use for installing gems -export HOMEBREW_GEM_HOME="$GEM_HOME" -export HOMEBREW_GEM_PATH="$GEM_PATH" +# Save values to use for installing gems +if [[ -n "$GEM_HOME" ]] +then + export HOMEBREW_GEM_HOME="$GEM_HOME" +fi +if [[ -n "$GEM_PATH" ]] +then + export HOMEBREW_GEM_PATH="$GEM_PATH" +fi # Users may have these set, pointing the system Ruby # at non-system gem paths @@ -308,9 +314,6 @@ update-preinstall() { [[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]] || return [[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || return - # Allow auto-update migration now we have a fix in place (below in this function). - export HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION="1" - if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "tap" ]] then if [[ -z "$HOMEBREW_VERBOSE" ]] @@ -319,6 +322,9 @@ update-preinstall() { timer_pid=$! fi + # Allow auto-update migration now we have a fix in place (below in this function). + export HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION="1" + brew update --preinstall if [[ -n "$timer_pid" ]]