update-report: migrate on newer auto-update.

If we have a `brew.sh` which has set
`HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION` then let's allow an auto-update
migration. That's because it contains the fix below it _before_ the
update happened which means the auto-update won't fail in the same way
as if updating from an old version.
This commit is contained in:
Mike McQuaid 2016-09-20 09:07:02 +01:00
parent d9023a65f0
commit 2ecd73bca4
2 changed files with 5 additions and 1 deletions

View File

@ -267,6 +267,9 @@ update-preinstall() {
[[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]] || return [[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]] || return
[[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || 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" ]] if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "tap" ]]
then then
brew update --preinstall brew update --preinstall

View File

@ -100,7 +100,8 @@ module Homebrew
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"] Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
# This should always be the last thing to run (but skip on auto-update). # This should always be the last thing to run (but skip on auto-update).
unless ARGV.include?("--preinstall") if !ARGV.include?("--preinstall") ||
ENV["HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION"]
migrate_legacy_repository_if_necessary migrate_legacy_repository_if_necessary
end end
end end