aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/brew.sh
diff options
context:
space:
mode:
authorMike McQuaid2016-09-19 14:12:44 +0100
committerMike McQuaid2016-09-19 14:12:44 +0100
commitc30665afa62c4f8fc8d776f121967dc6d6bf1ba7 (patch)
tree3a6fc3233a8d87f79163b10786a9351bfcb6917b /Library/Homebrew/brew.sh
parent13f08a2bd4ff3aec13423fa5bb62b6ef08ffa0c4 (diff)
downloadbrew-c30665afa62c4f8fc8d776f121967dc6d6bf1ba7.tar.bz2
brew.sh: fix repository auto-update change.
On auto-update `HOMEBREW_LIBRARY` may change location which means that it won't be found for the actual install command. Look for this having occurred and then set the new `HOMEBREW_LIBRARY` (and `HOMEBREW_REPOSITORY`) accordingly.
Diffstat (limited to 'Library/Homebrew/brew.sh')
-rw-r--r--Library/Homebrew/brew.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh
index 0fadecaba..d33cc8678 100644
--- a/Library/Homebrew/brew.sh
+++ b/Library/Homebrew/brew.sh
@@ -268,6 +268,17 @@ update-preinstall() {
brew update --preinstall
fi
+ # If brew update --preinstall did a migration then export the new locations.
+ if [[ "$HOMEBREW_REPOSITORY" = "/usr/local" &&
+ ! -d "$HOMEBREW_REPOSITORY/.git" &&
+ -d "/usr/local/Homebrew/.git" ]]
+ then
+ HOMEBREW_REPOSITORY="/usr/local/Homebrew"
+ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
+ export HOMEBREW_REPOSITORY
+ export HOMEBREW_LIBRARY
+ fi
+
# If we've checked for updates, we don't need to check again.
export HOMEBREW_NO_AUTO_UPDATE="1"
}