We do not use curl that much there, setting the HOMEBREW_ON_DEBIAN7 flag
allows to lower the version, so that we can successfully pass the curl
version check below.
`HOMEBREW_CURL_PATH` has an effect only when `HOMEBREW_DEVELOPER` is set. However, the part of `brew.sh` that prints a message about outdated cURL disregards the value of `HOMEBREW_DEVELOPER`, which leads to a misleadnig message telling the user that `HOMEBREW_CURL_PATH` is outdated even though another cURL was used/tested.
This PR fixes it and instructs Homebrew to:
1. Display a warning message when system cURL is outdated and either `HOMEBREW_CURL_PATH` **or `HOMEBREW_DEVELOPER`** are not set. New `HOMEBREW_CURL_WARNING` variable is set to display the above warning only once (useful when `brew` calls itself internally).
2. Display `Installing Homebrew cURL` before auto-installing cURL in `update.sh` (due to `HOMEBREW_FORCE_BREWED_CURL`) and stop/exit if this step fails.
3. Display `Installing Homebrew Git` before auto-installing Git in `update.sh` (due to `HOMEBREW_FORCE_BREWED_GIT`) and stop/exit if this step fails.
Reorder and restructure this file to make it as fast as possible for
e.g. `brew --prefix`. Once we have that, also give `brew shellenv`
short-circuit command execution to make it as fast as possible.
On my machine (with a warm cache) this gets:
```
brew shellenv 0.01s user 0.03s system 100% cpu 0.038 total
```
Compared to:
```
brew shellenv 0.09s user 0.19s system 100% cpu 0.277 total
```
before this commit.
This should help with cases like
https://github.com/Homebrew/homebrew-bundle/issues/751
and is good practise in general.
Also, document the `brew update --preinstall` flag that is being used
here so others can run it manually e.g. as part of CI if needed.
Change the default locale from en_US.UTF-8 to C.UTF-8 on Linux.
The former locale is not included by default in common Docker images,
whereas the latter locale is included by default.
The default locale remains en_US.UTF-8 on macOS.
User may specify which cURL and Git to use via
HOMEBREW_CURL_PATH and HOMEBREW_GIT_PATH.
So, let's use these to determine whether we need to use
their vendored alternatives.
- Concourse CI uses `garden` under the hood for its containers.
- Running the Homebrew Docker container for a Concourse job was failing
with the "can't run as root" error. In the same way as
bc320ad2291f5ec652d8f4bcf3f7b7ff3c9af3bd, this adds `garden` as one of
the allowed providers.