DomT4 / homebrew-autoupdate

:tropical_drink: An easy, convenient way to automatically update Homebrew.
BSD 2-Clause "Simplified" License
995 stars 55 forks source link

Disable building from source on failure #26

Closed vtta closed 4 years ago

vtta commented 4 years ago

On default, when installation from bottle fails, homebrew would fall back to build from source. But due to autoupdate happens at background, we cannot notice this in time and may often lead to unwanted battery drain. I added an environment variable in the update script to prevent this, and this method is found here

DomT4 commented 4 years ago

Does this leave HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK=1 set in the env after the script has finished executing? If it does we should probably unset it unless it exists already.

vtta commented 4 years ago

I think this variable would effect only one run, after which this generated script exits and leave no trace of ever setting this variable. But for safety, we can definitely add an unset or restore its original value at the end.

DomT4 commented 4 years ago

This seems fine as-is 👍. Double checked locally and as expected it doesn't seem to pass the variable back up to the parent shell. Just wanted to be sure on that.

If people object to this being set by default for this tool we can always make it conditional or add an opt-out of some description but for better or worse I know Homebrew has become such a binary-default package manager that formulae building from source has become an edge case most users would not expect or desire, so... we'll go with this and see.

Thanks for the PR @vtta!