mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
style: fix inconsistent code style for shell scripts
This commit is contained in:
parent
9c03493774
commit
3f96d963f7
20
.github/workflows/docker.yml
vendored
20
.github/workflows/docker.yml
vendored
@ -34,11 +34,11 @@ jobs:
|
|||||||
- name: Deploy the tagged Docker image to GitHub Packages
|
- name: Deploy the tagged Docker image to GitHub Packages
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
brew_version=${GITHUB_REF:10}
|
brew_version="${GITHUB_REF:10}"
|
||||||
echo "brew_version=$brew_version" >> ${GITHUB_ENV}
|
echo "brew_version=${brew_version}" >> "${GITHUB_ENV}"
|
||||||
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin
|
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin
|
||||||
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version"
|
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}"
|
||||||
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version"
|
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}"
|
||||||
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
|
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
|
||||||
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
|
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
|
||||||
|
|
||||||
@ -46,19 +46,19 @@ jobs:
|
|||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin
|
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin
|
||||||
docker tag brew "homebrew/ubuntu${{matrix.version}}:$brew_version"
|
docker tag brew "homebrew/ubuntu${{matrix.version}}:${brew_version}"
|
||||||
docker push "homebrew/ubuntu${{matrix.version}}:$brew_version"
|
docker push "homebrew/ubuntu${{matrix.version}}:${brew_version}"
|
||||||
docker tag brew "homebrew/ubuntu${{matrix.version}}:latest"
|
docker tag brew "homebrew/ubuntu${{matrix.version}}:latest"
|
||||||
docker push "homebrew/ubuntu${{matrix.version}}:latest"
|
docker push "homebrew/ubuntu${{matrix.version}}:latest"
|
||||||
|
|
||||||
- name: Deploy the homebrew/brew Docker image to GitHub Packages and Docker Hub
|
- name: Deploy the homebrew/brew Docker image to GitHub Packages and Docker Hub
|
||||||
if: startsWith(github.ref, 'refs/tags/') && matrix.version == '20.04'
|
if: startsWith(github.ref, 'refs/tags/') && matrix.version == '20.04'
|
||||||
run: |
|
run: |
|
||||||
docker tag brew "ghcr.io/homebrew/brew:$brew_version"
|
docker tag brew "ghcr.io/homebrew/brew:${brew_version}"
|
||||||
docker push "ghcr.io/homebrew/brew:$brew_version"
|
docker push "ghcr.io/homebrew/brew:${brew_version}"
|
||||||
docker tag brew "ghcr.io/homebrew/brew:latest"
|
docker tag brew "ghcr.io/homebrew/brew:latest"
|
||||||
docker push "ghcr.io/homebrew/brew:latest"
|
docker push "ghcr.io/homebrew/brew:latest"
|
||||||
docker tag brew "homebrew/brew:$brew_version"
|
docker tag brew "homebrew/brew:${brew_version}"
|
||||||
docker push "homebrew/brew:$brew_version"
|
docker push "homebrew/brew:${brew_version}"
|
||||||
docker tag brew "homebrew/brew:latest"
|
docker tag brew "homebrew/brew:latest"
|
||||||
docker push "homebrew/brew:latest"
|
docker push "homebrew/brew:latest"
|
||||||
|
17
.github/workflows/sorbet.yml
vendored
17
.github/workflows/sorbet.yml
vendored
@ -40,20 +40,23 @@ jobs:
|
|||||||
BRANCH="sorbet-files-update"
|
BRANCH="sorbet-files-update"
|
||||||
echo "::set-output name=branch::${BRANCH}"
|
echo "::set-output name=branch::${BRANCH}"
|
||||||
|
|
||||||
if git ls-remote --exit-code --heads origin "$BRANCH"; then
|
if git ls-remote --exit-code --heads origin "${BRANCH}"
|
||||||
git checkout "$BRANCH"
|
then
|
||||||
|
git checkout "${BRANCH}"
|
||||||
git reset --hard origin/master
|
git reset --hard origin/master
|
||||||
else
|
else
|
||||||
git checkout --no-track -B "$BRANCH" origin/master
|
git checkout --no-track -B "${BRANCH}" origin/master
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if brew typecheck --update --fail-if-not-changed; then
|
if brew typecheck --update --fail-if-not-changed
|
||||||
git add "$GITHUB_WORKSPACE/Library/Homebrew/sorbet"
|
then
|
||||||
|
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
|
||||||
git commit -m "sorbet: Update RBI files." \
|
git commit -m "sorbet: Update RBI files." \
|
||||||
-m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow."
|
-m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow."
|
||||||
echo "::set-output name=committed::true"
|
echo "::set-output name=committed::true"
|
||||||
PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
|
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
|
||||||
if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
|
if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
|
||||||
|
then
|
||||||
echo "::set-output name=pull_request::true"
|
echo "::set-output name=pull_request::true"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
17
.github/workflows/spdx.yml
vendored
17
.github/workflows/spdx.yml
vendored
@ -37,19 +37,22 @@ jobs:
|
|||||||
BRANCH="spdx-update"
|
BRANCH="spdx-update"
|
||||||
echo "::set-output name=branch::${BRANCH}"
|
echo "::set-output name=branch::${BRANCH}"
|
||||||
|
|
||||||
if git ls-remote --exit-code --heads origin "$BRANCH"; then
|
if git ls-remote --exit-code --heads origin "${BRANCH}"
|
||||||
git checkout "$BRANCH"
|
then
|
||||||
|
git checkout "${BRANCH}"
|
||||||
git reset --hard origin/master
|
git reset --hard origin/master
|
||||||
else
|
else
|
||||||
git checkout --no-track -B "$BRANCH" origin/master
|
git checkout --no-track -B "${BRANCH}" origin/master
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if brew update-license-data --fail-if-not-changed; then
|
if brew update-license-data --fail-if-not-changed
|
||||||
git add "$GITHUB_WORKSPACE/Library/Homebrew/data/spdx"
|
then
|
||||||
|
git add "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx"
|
||||||
git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
|
git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
|
||||||
echo "::set-output name=committed::true"
|
echo "::set-output name=committed::true"
|
||||||
PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
|
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
|
||||||
if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
|
if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
|
||||||
|
then
|
||||||
echo "::set-output name=pull_request::true"
|
echo "::set-output name=pull_request::true"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
21
.github/workflows/tests.yml
vendored
21
.github/workflows/tests.yml
vendored
@ -90,10 +90,10 @@ jobs:
|
|||||||
- name: Set up all Homebrew taps
|
- name: Set up all Homebrew taps
|
||||||
run: |
|
run: |
|
||||||
HOMEBREW_REPOSITORY="$(brew --repo)"
|
HOMEBREW_REPOSITORY="$(brew --repo)"
|
||||||
HOMEBREW_CORE_REPOSITORY="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core"
|
HOMEBREW_CORE_REPOSITORY="${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core"
|
||||||
git -C "$HOMEBREW_CORE_REPOSITORY" remote add homebrew_core https://github.com/Homebrew/homebrew-core
|
git -C "${HOMEBREW_CORE_REPOSITORY}" remote add homebrew_core https://github.com/Homebrew/homebrew-core
|
||||||
git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core || git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core
|
git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core || git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core
|
||||||
git -C "$HOMEBREW_CORE_REPOSITORY" checkout --force -B master homebrew_core/master
|
git -C "${HOMEBREW_CORE_REPOSITORY}" checkout --force -B master homebrew_core/master
|
||||||
|
|
||||||
brew tap homebrew/aliases
|
brew tap homebrew/aliases
|
||||||
brew tap homebrew/autoupdate
|
brew tap homebrew/autoupdate
|
||||||
@ -111,7 +111,7 @@ jobs:
|
|||||||
brew update-reset Library/Taps/homebrew/homebrew-bundle
|
brew update-reset Library/Taps/homebrew/homebrew-bundle
|
||||||
|
|
||||||
# brew style doesn't like world writable directories
|
# brew style doesn't like world writable directories
|
||||||
sudo chmod -R g-w,o-w "$HOMEBREW_REPOSITORY/Library/Taps"
|
sudo chmod -R g-w,o-w "${HOMEBREW_REPOSITORY}/Library/Taps"
|
||||||
|
|
||||||
- name: Run brew style on homebrew-core
|
- name: Run brew style on homebrew-core
|
||||||
run: brew style --display-cop-names homebrew/core
|
run: brew style --display-cop-names homebrew/core
|
||||||
@ -178,11 +178,11 @@ jobs:
|
|||||||
- name: Deploy the Docker image to GitHub Packages and Docker Hub
|
- name: Deploy the Docker image to GitHub Packages and Docker Hub
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: |
|
run: |
|
||||||
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | \
|
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} |
|
||||||
docker login ghcr.io -u BrewTestBot --password-stdin
|
docker login ghcr.io -u BrewTestBot --password-stdin
|
||||||
docker tag brew "ghcr.io/homebrew/ubuntu16.04:master"
|
docker tag brew "ghcr.io/homebrew/ubuntu16.04:master"
|
||||||
docker push "ghcr.io/homebrew/ubuntu16.04:master"
|
docker push "ghcr.io/homebrew/ubuntu16.04:master"
|
||||||
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | \
|
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} |
|
||||||
docker login -u brewtestbot --password-stdin
|
docker login -u brewtestbot --password-stdin
|
||||||
docker tag brew "homebrew/ubuntu16.04:master"
|
docker tag brew "homebrew/ubuntu16.04:master"
|
||||||
docker push "homebrew/ubuntu16.04:master"
|
docker push "homebrew/ubuntu16.04:master"
|
||||||
@ -321,9 +321,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Retry multiple times when using BuildPulse to detect and submit
|
# Retry multiple times when using BuildPulse to detect and submit
|
||||||
# flakiness (because rspec-retry is disabled).
|
# flakiness (because rspec-retry is disabled).
|
||||||
if [ -n "$HOMEBREW_BUILDPULSE_ACCESS_KEY_ID" ]; then
|
if [[ -n "${HOMEBREW_BUILDPULSE_ACCESS_KEY_ID}" ]]
|
||||||
brew tests --online --coverage || \
|
then
|
||||||
brew tests --online --coverage || \
|
brew tests --online --coverage ||
|
||||||
|
brew tests --online --coverage ||
|
||||||
brew tests --online --coverage
|
brew tests --online --coverage
|
||||||
else
|
else
|
||||||
brew tests --online --coverage
|
brew tests --online --coverage
|
||||||
|
26
.github/workflows/update-man-completions.yml
vendored
26
.github/workflows/update-man-completions.yml
vendored
@ -44,27 +44,31 @@ jobs:
|
|||||||
BRANCH=update-man-completions
|
BRANCH=update-man-completions
|
||||||
echo "::set-output name=branch::${BRANCH}"
|
echo "::set-output name=branch::${BRANCH}"
|
||||||
|
|
||||||
if git ls-remote --exit-code --heads origin "$BRANCH"; then
|
if git ls-remote --exit-code --heads origin "${BRANCH}"
|
||||||
git checkout "$BRANCH"
|
then
|
||||||
|
git checkout "${BRANCH}"
|
||||||
git reset --hard origin/master
|
git reset --hard origin/master
|
||||||
else
|
else
|
||||||
git checkout --no-track -B "$BRANCH" origin/master
|
git checkout --no-track -B "${BRANCH}" origin/master
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${{github.event_name}}" != "push" ]; then
|
if [[ "${{github.event_name}}" != "push" ]]
|
||||||
|
then
|
||||||
brew update-maintainers
|
brew update-maintainers
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if brew generate-man-completions --fail-if-not-changed; then
|
if brew generate-man-completions --fail-if-not-changed
|
||||||
git add "$GITHUB_WORKSPACE/README.md" \
|
then
|
||||||
"$GITHUB_WORKSPACE/docs/Manpage.md" \
|
git add "${GITHUB_WORKSPACE}/README.md" \
|
||||||
"$GITHUB_WORKSPACE/manpages/brew.1" \
|
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
|
||||||
"$GITHUB_WORKSPACE/completions"
|
"${GITHUB_WORKSPACE}/manpages/brew.1" \
|
||||||
|
"${GITHUB_WORKSPACE}/completions"
|
||||||
git commit -m "Update maintainers, manpage and completions." \
|
git commit -m "Update maintainers, manpage and completions." \
|
||||||
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/update-man-completions.yml) workflow."
|
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/update-man-completions.yml) workflow."
|
||||||
echo "::set-output name=committed::true"
|
echo "::set-output name=committed::true"
|
||||||
PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
|
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
|
||||||
if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
|
if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
|
||||||
|
then
|
||||||
echo "::set-output name=pull_request::true"
|
echo "::set-output name=pull_request::true"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
9
.github/workflows/vendor-gems.yml
vendored
9
.github/workflows/vendor-gems.yml
vendored
@ -51,7 +51,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
if [[ "${GEM_NAME}" == 'sorbet' ]]; then
|
if [[ "${GEM_NAME}" == 'sorbet' ]]
|
||||||
|
then
|
||||||
brew vendor-gems --update sorbet,sorbet-runtime
|
brew vendor-gems --update sorbet,sorbet-runtime
|
||||||
else
|
else
|
||||||
brew vendor-gems
|
brew vendor-gems
|
||||||
@ -63,8 +64,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
if brew typecheck --update --fail-if-not-changed; then
|
if brew typecheck --update --fail-if-not-changed
|
||||||
if git add Library/Homebrew/sorbet; then
|
then
|
||||||
|
if git add Library/Homebrew/sorbet
|
||||||
|
then
|
||||||
git commit -m "Update RBI files for ${GEM_NAME}."
|
git commit -m "Update RBI files for ${GEM_NAME}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -2,5 +2,5 @@
|
|||||||
"ruby.rubocop.executePath": "Library/Homebrew/shims/gems/",
|
"ruby.rubocop.executePath": "Library/Homebrew/shims/gems/",
|
||||||
"files.trimTrailingWhitespace": true,
|
"files.trimTrailingWhitespace": true,
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ RUN apt-get update \
|
|||||||
|
|
||||||
USER linuxbrew
|
USER linuxbrew
|
||||||
COPY --chown=linuxbrew:linuxbrew . /home/linuxbrew/.linuxbrew/Homebrew
|
COPY --chown=linuxbrew:linuxbrew . /home/linuxbrew/.linuxbrew/Homebrew
|
||||||
ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
|
ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"
|
||||||
WORKDIR /home/linuxbrew
|
WORKDIR /home/linuxbrew
|
||||||
|
|
||||||
RUN mkdir -p \
|
RUN mkdir -p \
|
||||||
|
@ -17,10 +17,11 @@ esac
|
|||||||
# same file under the native architecture
|
# same file under the native architecture
|
||||||
# These variables are set from the user environment.
|
# These variables are set from the user environment.
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ "${HOMEBREW_CHANGE_ARCH_TO_ARM}" = "1" ]] && \
|
if [[ "${HOMEBREW_CHANGE_ARCH_TO_ARM}" == "1" ]] &&
|
||||||
[[ "${HOMEBREW_MACOS}" = "1" ]] && \
|
[[ "${HOMEBREW_MACOS}" == "1" ]] &&
|
||||||
[[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" = "1" ]] && \
|
[[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" == "1" ]] &&
|
||||||
[[ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]]; then
|
[[ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" == "1" ]]
|
||||||
|
then
|
||||||
exec arch -arm64e "${HOMEBREW_BREW_FILE}" "$@"
|
exec arch -arm64e "${HOMEBREW_BREW_FILE}" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
|
|||||||
# shellcheck disable=SC2249,SC2154
|
# shellcheck disable=SC2249,SC2154
|
||||||
case "$*" in
|
case "$*" in
|
||||||
--cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
|
--cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
|
||||||
--repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
|
--repository | --repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
|
||||||
--caskroom) echo "${HOMEBREW_PREFIX}/Caskroom"; exit 0 ;;
|
--caskroom) echo "${HOMEBREW_PREFIX}/Caskroom"; exit 0 ;;
|
||||||
--cache) echo "${HOMEBREW_CACHE}"; exit 0 ;;
|
--cache) echo "${HOMEBREW_CACHE}"; exit 0 ;;
|
||||||
shellenv) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"; homebrew-shellenv; exit 0 ;;
|
shellenv) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"; homebrew-shellenv; exit 0 ;;
|
||||||
@ -144,16 +145,16 @@ numeric() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check-run-command-as-root() {
|
check-run-command-as-root() {
|
||||||
[[ "$(id -u)" = 0 ]] || return
|
[[ "$(id -u)" == 0 ]] || return
|
||||||
|
|
||||||
# Allow Azure Pipelines/GitHub Actions/Docker/Concourse/Kubernetes to do everything as root (as it's normal there)
|
# Allow Azure Pipelines/GitHub Actions/Docker/Concourse/Kubernetes to do everything as root (as it's normal there)
|
||||||
[[ -f /proc/1/cgroup ]] && grep -E "azpl_job|actions_job|docker|garden|kubepods" -q /proc/1/cgroup && return
|
[[ -f /proc/1/cgroup ]] && grep -E "azpl_job|actions_job|docker|garden|kubepods" -q /proc/1/cgroup && return
|
||||||
|
|
||||||
# Homebrew Services may need `sudo` for system-wide daemons.
|
# Homebrew Services may need `sudo` for system-wide daemons.
|
||||||
[[ "${HOMEBREW_COMMAND}" = "services" ]] && return
|
[[ "${HOMEBREW_COMMAND}" == "services" ]] && return
|
||||||
|
|
||||||
# It's fine to run this as root as it's not changing anything.
|
# It's fine to run this as root as it's not changing anything.
|
||||||
[[ "${HOMEBREW_COMMAND}" = "--prefix" ]] && return
|
[[ "${HOMEBREW_COMMAND}" == "--prefix" ]] && return
|
||||||
|
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
Running Homebrew as root is extremely dangerous and no longer supported.
|
Running Homebrew as root is extremely dangerous and no longer supported.
|
||||||
@ -165,7 +166,7 @@ EOS
|
|||||||
check-prefix-is-not-tmpdir() {
|
check-prefix-is-not-tmpdir() {
|
||||||
[[ -z "${HOMEBREW_MACOS}" ]] && return
|
[[ -z "${HOMEBREW_MACOS}" ]] && return
|
||||||
|
|
||||||
if [[ "${HOMEBREW_PREFIX}" = "${HOMEBREW_TEMP}"* ]]
|
if [[ "${HOMEBREW_PREFIX}" == "${HOMEBREW_TEMP}"* ]]
|
||||||
then
|
then
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
Your HOMEBREW_PREFIX is in the Homebrew temporary directory, which Homebrew
|
Your HOMEBREW_PREFIX is in the Homebrew temporary directory, which Homebrew
|
||||||
@ -195,10 +196,13 @@ update-preinstall() {
|
|||||||
# If we've checked for updates, we don't need to check again.
|
# If we've checked for updates, we don't need to check again.
|
||||||
export HOMEBREW_AUTO_UPDATE_CHECKED="1"
|
export HOMEBREW_AUTO_UPDATE_CHECKED="1"
|
||||||
|
|
||||||
if [[ "${HOMEBREW_COMMAND}" = "install" || "${HOMEBREW_COMMAND}" = "upgrade" ||
|
if [[ "${HOMEBREW_COMMAND}" == "install" ]] ||
|
||||||
"${HOMEBREW_COMMAND}" = "bump-formula-pr" || "${HOMEBREW_COMMAND}" = "bump-cask-pr" ||
|
[[ "${HOMEBREW_COMMAND}" == "upgrade" ]] ||
|
||||||
"${HOMEBREW_COMMAND}" = "bundle" || "${HOMEBREW_COMMAND}" = "release" ||
|
[[ "${HOMEBREW_COMMAND}" == "bump-formula-pr" ]] ||
|
||||||
"${HOMEBREW_COMMAND}" = "tap" && ${HOMEBREW_ARG_COUNT} -gt 1 ]]
|
[[ "${HOMEBREW_COMMAND}" == "bump-cask-pr" ]] ||
|
||||||
|
[[ "${HOMEBREW_COMMAND}" == "bundle" ]] ||
|
||||||
|
[[ "${HOMEBREW_COMMAND}" == "release" ]] ||
|
||||||
|
[[ "${HOMEBREW_COMMAND}" == "tap" && "${HOMEBREW_ARG_COUNT}" -gt 1 ]]
|
||||||
then
|
then
|
||||||
export HOMEBREW_AUTO_UPDATING="1"
|
export HOMEBREW_AUTO_UPDATING="1"
|
||||||
|
|
||||||
@ -210,8 +214,8 @@ update-preinstall() {
|
|||||||
# Skip auto-update if the repository has been updated in the
|
# Skip auto-update if the repository has been updated in the
|
||||||
# last $HOMEBREW_AUTO_UPDATE_SECS.
|
# last $HOMEBREW_AUTO_UPDATE_SECS.
|
||||||
repo_fetch_head="${HOMEBREW_REPOSITORY}/.git/FETCH_HEAD"
|
repo_fetch_head="${HOMEBREW_REPOSITORY}/.git/FETCH_HEAD"
|
||||||
if [[ -f "${repo_fetch_head}" &&
|
if [[ -f "${repo_fetch_head}" ]] &&
|
||||||
-n "$(find "${repo_fetch_head}" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]]
|
[[ -n "$(find "${repo_fetch_head}" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]]
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -244,7 +248,8 @@ update-preinstall() {
|
|||||||
# Colorize output on GitHub Actions.
|
# Colorize output on GitHub Actions.
|
||||||
# This is set by the user environment.
|
# This is set by the user environment.
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ -n "${GITHUB_ACTIONS}" ]]; then
|
if [[ -n "${GITHUB_ACTIONS}" ]]
|
||||||
|
then
|
||||||
export HOMEBREW_COLOR="1"
|
export HOMEBREW_COLOR="1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -261,13 +266,13 @@ else
|
|||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
elif [[ "$(locale charmap)" != "UTF-8" ]]
|
elif [[ "$(locale charmap)" != "UTF-8" ]]
|
||||||
then
|
then
|
||||||
locales=$(locale -a)
|
locales="$(locale -a)"
|
||||||
c_utf_regex='\bC\.(utf8|UTF-8)\b'
|
c_utf_regex='\bC\.(utf8|UTF-8)\b'
|
||||||
en_us_regex='\ben_US\.(utf8|UTF-8)\b'
|
en_us_regex='\ben_US\.(utf8|UTF-8)\b'
|
||||||
utf_regex='\b[a-z][a-z]_[A-Z][A-Z]\.(utf8|UTF-8)\b'
|
utf_regex='\b[a-z][a-z]_[A-Z][A-Z]\.(utf8|UTF-8)\b'
|
||||||
if [[ ${locales} =~ ${c_utf_regex} || ${locales} =~ ${en_us_regex} || ${locales} =~ ${utf_regex} ]]
|
if [[ ${locales} =~ ${c_utf_regex} || ${locales} =~ ${en_us_regex} || ${locales} =~ ${utf_regex} ]]
|
||||||
then
|
then
|
||||||
export LC_ALL=${BASH_REMATCH[0]}
|
export LC_ALL="${BASH_REMATCH[0]}"
|
||||||
else
|
else
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
fi
|
fi
|
||||||
@ -278,7 +283,7 @@ fi
|
|||||||
##### odie as quickly as possible.
|
##### odie as quickly as possible.
|
||||||
#####
|
#####
|
||||||
|
|
||||||
if [[ "${HOMEBREW_PREFIX}" = "/" || "${HOMEBREW_PREFIX}" = "/usr" ]]
|
if [[ "${HOMEBREW_PREFIX}" == "/" || "${HOMEBREW_PREFIX}" == "/usr" ]]
|
||||||
then
|
then
|
||||||
# it may work, but I only see pain this route and don't want to support it
|
# it may work, but I only see pain this route and don't want to support it
|
||||||
odie "Cowardly refusing to continue at this prefix: ${HOMEBREW_PREFIX}"
|
odie "Cowardly refusing to continue at this prefix: ${HOMEBREW_PREFIX}"
|
||||||
@ -296,16 +301,15 @@ fi
|
|||||||
#####
|
#####
|
||||||
|
|
||||||
# USER isn't always set so provide a fall back for `brew` and subprocesses.
|
# USER isn't always set so provide a fall back for `brew` and subprocesses.
|
||||||
export USER=${USER:-$(id -un)}
|
export USER="${USER:-$(id -un)}"
|
||||||
|
|
||||||
# A depth of 1 means this command was directly invoked by a user.
|
# A depth of 1 means this command was directly invoked by a user.
|
||||||
# Higher depths mean this command was invoked by another Homebrew command.
|
# Higher depths mean this command was invoked by another Homebrew command.
|
||||||
export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1))
|
export HOMEBREW_COMMAND_DEPTH="$((HOMEBREW_COMMAND_DEPTH + 1))"
|
||||||
|
|
||||||
# This is set by the user environment.
|
# This is set by the user environment.
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" &&
|
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
|
||||||
-x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
|
|
||||||
"${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version >/dev/null
|
"${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version >/dev/null
|
||||||
then
|
then
|
||||||
HOMEBREW_CURL="${HOMEBREW_PREFIX}/opt/curl/bin/curl"
|
HOMEBREW_CURL="${HOMEBREW_PREFIX}/opt/curl/bin/curl"
|
||||||
@ -318,8 +322,7 @@ fi
|
|||||||
|
|
||||||
# This is set by the user environment.
|
# This is set by the user environment.
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" &&
|
if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] &&
|
||||||
-x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] &&
|
|
||||||
"${HOMEBREW_PREFIX}/opt/git/bin/git" --version >/dev/null
|
"${HOMEBREW_PREFIX}/opt/git/bin/git" --version >/dev/null
|
||||||
then
|
then
|
||||||
HOMEBREW_GIT="${HOMEBREW_PREFIX}/opt/git/bin/git"
|
HOMEBREW_GIT="${HOMEBREW_PREFIX}/opt/git/bin/git"
|
||||||
@ -344,7 +347,11 @@ HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core"
|
|||||||
HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask"
|
HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask"
|
||||||
|
|
||||||
case "$*" in
|
case "$*" in
|
||||||
--version|-v) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"; homebrew-version; exit 0 ;;
|
--version | -v)
|
||||||
|
source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"
|
||||||
|
homebrew-version
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
@ -357,7 +364,7 @@ if [[ -n "${HOMEBREW_MACOS}" ]]
|
|||||||
then
|
then
|
||||||
HOMEBREW_PRODUCT="Homebrew"
|
HOMEBREW_PRODUCT="Homebrew"
|
||||||
HOMEBREW_SYSTEM="Macintosh"
|
HOMEBREW_SYSTEM="Macintosh"
|
||||||
[[ "${HOMEBREW_PROCESSOR}" = "x86_64" ]] && HOMEBREW_PROCESSOR="Intel"
|
[[ "${HOMEBREW_PROCESSOR}" == "x86_64" ]] && HOMEBREW_PROCESSOR="Intel"
|
||||||
HOMEBREW_MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"
|
HOMEBREW_MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"
|
||||||
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
|
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
|
||||||
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X ${HOMEBREW_MACOS_VERSION}"
|
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X ${HOMEBREW_MACOS_VERSION}"
|
||||||
@ -423,17 +430,19 @@ else
|
|||||||
curl_version_output="$(${HOMEBREW_CURL} --version 2>/dev/null)"
|
curl_version_output="$(${HOMEBREW_CURL} --version 2>/dev/null)"
|
||||||
curl_name_and_version="${curl_version_output%% (*}"
|
curl_name_and_version="${curl_version_output%% (*}"
|
||||||
# shellcheck disable=SC2248
|
# shellcheck disable=SC2248
|
||||||
if [[ $(numeric "${curl_name_and_version##* }") -lt $(numeric "${HOMEBREW_MINIMUM_CURL_VERSION}") ]]
|
if [[ "$(numeric "${curl_name_and_version##* }")" -lt "$(numeric "${HOMEBREW_MINIMUM_CURL_VERSION}")" ]]
|
||||||
then
|
then
|
||||||
message="Please update your system curl.
|
message="Please update your system curl.
|
||||||
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}
|
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}
|
||||||
Your curl version: ${curl_name_and_version##* }
|
Your curl version: ${curl_name_and_version##* }
|
||||||
Your curl executable: $(type -p ${HOMEBREW_CURL})"
|
Your curl executable: $(type -p ${HOMEBREW_CURL})"
|
||||||
|
|
||||||
if [[ -z ${HOMEBREW_CURL_PATH} || -z ${HOMEBREW_DEVELOPER} ]]; then
|
if [[ -z ${HOMEBREW_CURL_PATH} || -z ${HOMEBREW_DEVELOPER} ]]
|
||||||
|
then
|
||||||
HOMEBREW_SYSTEM_CURL_TOO_OLD=1
|
HOMEBREW_SYSTEM_CURL_TOO_OLD=1
|
||||||
HOMEBREW_FORCE_BREWED_CURL=1
|
HOMEBREW_FORCE_BREWED_CURL=1
|
||||||
if [[ -z ${HOMEBREW_CURL_WARNING} ]]; then
|
if [[ -z ${HOMEBREW_CURL_WARNING} ]]
|
||||||
|
then
|
||||||
onoe "${message}"
|
onoe "${message}"
|
||||||
HOMEBREW_CURL_WARNING=1
|
HOMEBREW_CURL_WARNING=1
|
||||||
fi
|
fi
|
||||||
@ -448,17 +457,19 @@ Your curl executable: $(type -p ${HOMEBREW_CURL})"
|
|||||||
git_version_output="$(${HOMEBREW_GIT} --version 2>/dev/null)"
|
git_version_output="$(${HOMEBREW_GIT} --version 2>/dev/null)"
|
||||||
# $extra is intentionally discarded.
|
# $extra is intentionally discarded.
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
IFS=. read -r major minor micro build extra <<< "${git_version_output##* }"
|
IFS='.' read -r major minor micro build extra <<<"${git_version_output##* }"
|
||||||
# shellcheck disable=SC2248
|
# shellcheck disable=SC2248
|
||||||
if [[ $(numeric "${major}.${minor}.${micro}.${build}") -lt $(numeric "${HOMEBREW_MINIMUM_GIT_VERSION}") ]]
|
if [[ "$(numeric "${major}.${minor}.${micro}.${build}")" -lt "$(numeric "${HOMEBREW_MINIMUM_GIT_VERSION}")" ]]
|
||||||
then
|
then
|
||||||
message="Please update your system Git.
|
message="Please update your system Git.
|
||||||
Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION}
|
Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION}
|
||||||
Your Git version: ${major}.${minor}.${micro}.${build}
|
Your Git version: ${major}.${minor}.${micro}.${build}
|
||||||
Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
|
Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
|
||||||
if [[ -z ${HOMEBREW_GIT_PATH} || -z ${HOMEBREW_DEVELOPER} ]]; then
|
if [[ -z ${HOMEBREW_GIT_PATH} || -z ${HOMEBREW_DEVELOPER} ]]
|
||||||
|
then
|
||||||
HOMEBREW_FORCE_BREWED_GIT="1"
|
HOMEBREW_FORCE_BREWED_GIT="1"
|
||||||
if [[ -z ${HOMEBREW_GIT_WARNING} ]]; then
|
if [[ -z ${HOMEBREW_GIT_WARNING} ]]
|
||||||
|
then
|
||||||
onoe "${message}"
|
onoe "${message}"
|
||||||
HOMEBREW_GIT_WARNING=1
|
HOMEBREW_GIT_WARNING=1
|
||||||
fi
|
fi
|
||||||
@ -471,7 +482,7 @@ Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
|
|||||||
unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
|
unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
|
||||||
|
|
||||||
HOMEBREW_CORE_REPOSITORY_ORIGIN="$("${HOMEBREW_GIT}" -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin)"
|
HOMEBREW_CORE_REPOSITORY_ORIGIN="$("${HOMEBREW_GIT}" -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin)"
|
||||||
if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" = "https://github.com/Homebrew/homebrew-core" ]]
|
if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" == "https://github.com/Homebrew/homebrew-core" ]]
|
||||||
then
|
then
|
||||||
# If the remote origin has been set to Homebrew/homebrew-core by the install script,
|
# If the remote origin has been set to Homebrew/homebrew-core by the install script,
|
||||||
# then we are in the case of a new installation of brew, using Homebrew/homebrew-core as a Linux core repository.
|
# then we are in the case of a new installation of brew, using Homebrew/homebrew-core as a Linux core repository.
|
||||||
@ -490,12 +501,15 @@ fi
|
|||||||
# That will be when macOS 12 is the minimum required version.
|
# That will be when macOS 12 is the minimum required version.
|
||||||
# HOMEBREW_BOTTLE_DOMAIN is set from the user environment
|
# HOMEBREW_BOTTLE_DOMAIN is set from the user environment
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ -n "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" && "${HOMEBREW_BOTTLE_DOMAIN}" = "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]]
|
if [[ -n "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]] &&
|
||||||
|
[[ "${HOMEBREW_BOTTLE_DOMAIN}" == "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]]
|
||||||
then
|
then
|
||||||
unset HOMEBREW_BOTTLE_DOMAIN
|
unset HOMEBREW_BOTTLE_DOMAIN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${HOMEBREW_MACOS}" || -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" || -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
|
if [[ -n "${HOMEBREW_MACOS}" ]] ||
|
||||||
|
[[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] ||
|
||||||
|
[[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/homebrew/core"
|
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/homebrew/core"
|
||||||
else
|
else
|
||||||
@ -535,8 +549,8 @@ export HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
|
|||||||
|
|
||||||
if [[ -n "${HOMEBREW_MACOS}" && -x "/usr/bin/xcode-select" ]]
|
if [[ -n "${HOMEBREW_MACOS}" && -x "/usr/bin/xcode-select" ]]
|
||||||
then
|
then
|
||||||
XCODE_SELECT_PATH=$('/usr/bin/xcode-select' --print-path 2>/dev/null)
|
XCODE_SELECT_PATH="$('/usr/bin/xcode-select' --print-path 2>/dev/null)"
|
||||||
if [[ "${XCODE_SELECT_PATH}" = "/" ]]
|
if [[ "${XCODE_SELECT_PATH}" == "/" ]]
|
||||||
then
|
then
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
Your xcode-select path is currently set to '/'.
|
Your xcode-select path is currently set to '/'.
|
||||||
@ -555,7 +569,7 @@ EOS
|
|||||||
XCRUN_OUTPUT="$(/usr/bin/xcrun clang 2>&1)"
|
XCRUN_OUTPUT="$(/usr/bin/xcrun clang 2>&1)"
|
||||||
XCRUN_STATUS="$?"
|
XCRUN_STATUS="$?"
|
||||||
|
|
||||||
if [[ "${XCRUN_STATUS}" -ne 0 && "${XCRUN_OUTPUT}" = *license* ]]
|
if [[ "${XCRUN_STATUS}" -ne 0 && "${XCRUN_OUTPUT}" == *license* ]]
|
||||||
then
|
then
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
You have not agreed to the Xcode license. Please resolve this by running:
|
You have not agreed to the Xcode license. Please resolve this by running:
|
||||||
@ -565,7 +579,7 @@ EOS
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" = -v ]]
|
if [[ "$1" == "-v" ]]
|
||||||
then
|
then
|
||||||
# Shift the -v to the end of the parameter list
|
# Shift the -v to the end of the parameter list
|
||||||
shift
|
shift
|
||||||
@ -574,9 +588,9 @@ fi
|
|||||||
|
|
||||||
for arg in "$@"
|
for arg in "$@"
|
||||||
do
|
do
|
||||||
[[ ${arg} = "--" ]] && break
|
[[ "${arg}" == "--" ]] && break
|
||||||
|
|
||||||
if [[ ${arg} = "--help" || ${arg} = "-h" || ${arg} = "--usage" || ${arg} = "-?" ]]
|
if [[ "${arg}" == "--help" || "${arg}" == "-h" || "${arg}" == "--usage" || "${arg}" == "-?" ]]
|
||||||
then
|
then
|
||||||
export HOMEBREW_HELP="1"
|
export HOMEBREW_HELP="1"
|
||||||
break
|
break
|
||||||
@ -611,7 +625,7 @@ if [[ -z "${HOMEBREW_DEVELOPER}" ]]
|
|||||||
then
|
then
|
||||||
export HOMEBREW_GIT_CONFIG_FILE="${HOMEBREW_REPOSITORY}/.git/config"
|
export HOMEBREW_GIT_CONFIG_FILE="${HOMEBREW_REPOSITORY}/.git/config"
|
||||||
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="${HOMEBREW_GIT_CONFIG_FILE}" --get homebrew.devcmdrun 2>/dev/null)"
|
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="${HOMEBREW_GIT_CONFIG_FILE}" --get homebrew.devcmdrun 2>/dev/null)"
|
||||||
if [[ "${HOMEBREW_GIT_CONFIG_DEVELOPERMODE}" = "true" ]]
|
if [[ "${HOMEBREW_GIT_CONFIG_DEVELOPERMODE}" == "true" ]]
|
||||||
then
|
then
|
||||||
export HOMEBREW_DEV_CMD_RUN="1"
|
export HOMEBREW_DEV_CMD_RUN="1"
|
||||||
fi
|
fi
|
||||||
@ -635,7 +649,9 @@ then
|
|||||||
fi
|
fi
|
||||||
export HOMEBREW_BREW_GIT_REMOTE
|
export HOMEBREW_BREW_GIT_REMOTE
|
||||||
|
|
||||||
if [[ -n "${HOMEBREW_MACOS}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
|
if [[ -n "${HOMEBREW_MACOS}" ]] ||
|
||||||
|
[[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] ||
|
||||||
|
[[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
|
HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
|
||||||
else
|
else
|
||||||
@ -676,9 +692,9 @@ check-run-command-as-root
|
|||||||
check-prefix-is-not-tmpdir
|
check-prefix-is-not-tmpdir
|
||||||
|
|
||||||
# shellcheck disable=SC2250
|
# shellcheck disable=SC2250
|
||||||
if [[ "${HOMEBREW_PREFIX}" = "/usr/local" &&
|
if [[ "${HOMEBREW_PREFIX}" == "/usr/local" ]] &&
|
||||||
"${HOMEBREW_PREFIX}" != "${HOMEBREW_REPOSITORY}" &&
|
[[ "${HOMEBREW_PREFIX}" != "${HOMEBREW_REPOSITORY}" ]] &&
|
||||||
"${HOMEBREW_CELLAR}" = "${HOMEBREW_REPOSITORY}/Cellar" ]]
|
[[ "${HOMEBREW_CELLAR}" == "${HOMEBREW_REPOSITORY}/Cellar" ]]
|
||||||
then
|
then
|
||||||
cat >&2 <<EOS
|
cat >&2 <<EOS
|
||||||
Warning: your HOMEBREW_PREFIX is set to /usr/local but HOMEBREW_CELLAR is set
|
Warning: your HOMEBREW_PREFIX is set to /usr/local but HOMEBREW_CELLAR is set
|
||||||
@ -702,7 +718,13 @@ then
|
|||||||
# Shellcheck can't follow this dynamic `source`.
|
# Shellcheck can't follow this dynamic `source`.
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${HOMEBREW_BASH_COMMAND}"
|
source "${HOMEBREW_BASH_COMMAND}"
|
||||||
{ update-preinstall "$@"; "homebrew-${HOMEBREW_COMMAND}" "$@"; exit $?; }
|
|
||||||
|
{
|
||||||
|
update-preinstall "$@"
|
||||||
|
"homebrew-${HOMEBREW_COMMAND}" "$@"
|
||||||
|
exit $?
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
|
||||||
setup-ruby-path
|
setup-ruby-path
|
||||||
@ -711,5 +733,9 @@ else
|
|||||||
[[ "${HOMEBREW_ARG_COUNT}" -gt 0 ]] && set -- "${HOMEBREW_COMMAND}" "$@"
|
[[ "${HOMEBREW_ARG_COUNT}" -gt 0 ]] && set -- "${HOMEBREW_COMMAND}" "$@"
|
||||||
# HOMEBREW_RUBY_PATH set by utils/ruby.sh
|
# HOMEBREW_RUBY_PATH set by utils/ruby.sh
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
{ update-preinstall "$@"; exec "${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_WARNINGS}" "${RUBY_DISABLE_OPTIONS}" "${HOMEBREW_LIBRARY}/Homebrew/brew.rb" "$@"; }
|
{
|
||||||
|
update-preinstall "$@"
|
||||||
|
exec "${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_WARNINGS}" "${RUBY_DISABLE_OPTIONS}" \
|
||||||
|
"${HOMEBREW_LIBRARY}/Homebrew/brew.rb" "$@"
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
|
@ -4,34 +4,41 @@ set -euo pipefail
|
|||||||
|
|
||||||
# Try removing as many empty directories as possible with a single
|
# Try removing as many empty directories as possible with a single
|
||||||
# `rmdir` call to avoid or at least speed up the loop below.
|
# `rmdir` call to avoid or at least speed up the loop below.
|
||||||
if /bin/rmdir -- "${@}" &>/dev/null; then
|
if /bin/rmdir -- "${@}" &>/dev/null
|
||||||
|
then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for path in "${@}"; do
|
for path in "${@}"
|
||||||
|
do
|
||||||
symlink=true
|
symlink=true
|
||||||
[[ -L "${path}" ]] || symlink=false
|
[[ -L "${path}" ]] || symlink=false
|
||||||
|
|
||||||
directory=false
|
directory=false
|
||||||
if [[ -d "${path}" ]]; then
|
if [[ -d "${path}" ]]
|
||||||
|
then
|
||||||
directory=true
|
directory=true
|
||||||
|
|
||||||
if [[ -e "${path}/.DS_Store" ]]; then
|
if [[ -e "${path}/.DS_Store" ]]
|
||||||
|
then
|
||||||
/bin/rm -- "${path}/.DS_Store"
|
/bin/rm -- "${path}/.DS_Store"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Some packages leave broken symlinks around; we clean them out before
|
# Some packages leave broken symlinks around; we clean them out before
|
||||||
# attempting to `rmdir` to prevent extra cruft from accumulating.
|
# attempting to `rmdir` to prevent extra cruft from accumulating.
|
||||||
/usr/bin/find -f "${path}" -- -mindepth 1 -maxdepth 1 -type l ! -exec /bin/test -e {} \; -delete
|
/usr/bin/find -f "${path}" -- -mindepth 1 -maxdepth 1 -type l ! -exec /bin/test -e {} \; -delete
|
||||||
elif ! ${symlink} && [[ ! -e "${path}" ]]; then
|
elif ! ${symlink} && [[ ! -e "${path}" ]]
|
||||||
|
then
|
||||||
# Skip paths that don't exists and aren't a broken symlink.
|
# Skip paths that don't exists and aren't a broken symlink.
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${symlink}; then
|
if ${symlink}
|
||||||
|
then
|
||||||
# Delete directory symlink.
|
# Delete directory symlink.
|
||||||
/bin/rm -- "${path}"
|
/bin/rm -- "${path}"
|
||||||
elif ${directory}; then
|
elif ${directory}
|
||||||
|
then
|
||||||
# Delete directory if empty.
|
# Delete directory if empty.
|
||||||
/usr/bin/find -f "${path}" -- -maxdepth 0 -type d -empty -exec /bin/rmdir -- {} \;
|
/usr/bin/find -f "${path}" -- -maxdepth 0 -type d -empty -exec /bin/rmdir -- {} \;
|
||||||
else
|
else
|
||||||
|
@ -6,20 +6,22 @@
|
|||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
version_string() {
|
version_string() {
|
||||||
local repo="$1"
|
local repo="$1"
|
||||||
if ! [ -d "${repo}" ]; then
|
if ! [[ -d "${repo}" ]]
|
||||||
|
then
|
||||||
echo "N/A"
|
echo "N/A"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local pretty_revision
|
local pretty_revision
|
||||||
pretty_revision="$(git -C "${repo}" rev-parse --short --verify --quiet HEAD)"
|
pretty_revision="$(git -C "${repo}" rev-parse --short --verify --quiet HEAD)"
|
||||||
if [ -z "${pretty_revision}" ]; then
|
if [[ -z "${pretty_revision}" ]]
|
||||||
|
then
|
||||||
echo "(no Git repository)"
|
echo "(no Git repository)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local git_last_commit_date
|
local git_last_commit_date
|
||||||
git_last_commit_date=$(git -C "${repo}" show -s --format='%cd' --date=short HEAD)
|
git_last_commit_date="$(git -C "${repo}" show -s --format='%cd' --date=short HEAD)"
|
||||||
echo "(git revision ${pretty_revision}; last commit ${git_last_commit_date})"
|
echo "(git revision ${pretty_revision}; last commit ${git_last_commit_date})"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +29,8 @@ homebrew-version() {
|
|||||||
echo "Homebrew ${HOMEBREW_VERSION}"
|
echo "Homebrew ${HOMEBREW_VERSION}"
|
||||||
echo "Homebrew/homebrew-core $(version_string "${HOMEBREW_CORE_REPOSITORY}")"
|
echo "Homebrew/homebrew-core $(version_string "${HOMEBREW_CORE_REPOSITORY}")"
|
||||||
|
|
||||||
if [ -d "${HOMEBREW_CASK_REPOSITORY}" ]; then
|
if [[ -d "${HOMEBREW_CASK_REPOSITORY}" ]]
|
||||||
|
then
|
||||||
echo "Homebrew/homebrew-cask $(version_string "${HOMEBREW_CASK_REPOSITORY}")"
|
echo "Homebrew/homebrew-cask $(version_string "${HOMEBREW_CASK_REPOSITORY}")"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
#:
|
#:
|
||||||
#: The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
|
#: The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
|
||||||
#: The variable `HOMEBREW_SHELLENV_PREFIX` will be exported to avoid adding duplicate entries to the environment variables.
|
#: The variable `HOMEBREW_SHELLENV_PREFIX` will be exported to avoid adding duplicate entries to the environment variables.
|
||||||
#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)`
|
#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval "$(brew shellenv)"`
|
||||||
|
|
||||||
# HOMEBREW_CELLAR and HOMEBREW_PREFIX are set by extend/ENV/super.rb
|
# HOMEBREW_CELLAR and HOMEBREW_PREFIX are set by extend/ENV/super.rb
|
||||||
# HOMEBREW_REPOSITORY is set by bin/brew
|
# HOMEBREW_REPOSITORY is set by bin/brew
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
homebrew-shellenv() {
|
homebrew-shellenv() {
|
||||||
[[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" &&
|
[[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" ]] &&
|
||||||
"$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]] && return
|
[[ "$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]] && return
|
||||||
|
|
||||||
case "$(/bin/ps -p "${PPID}" -c -o comm=)" in
|
case "$(/bin/ps -p "${PPID}" -c -o comm=)" in
|
||||||
fish | -fish)
|
fish | -fish)
|
||||||
|
@ -11,10 +11,10 @@ homebrew-update-reset() {
|
|||||||
for option in "$@"
|
for option in "$@"
|
||||||
do
|
do
|
||||||
case "${option}" in
|
case "${option}" in
|
||||||
-\?|-h|--help|--usage) brew help update-reset; exit $? ;;
|
-\? | -h | --help | --usage) brew help update-reset; exit $? ;;
|
||||||
--debug) HOMEBREW_DEBUG=1 ;;
|
--debug) HOMEBREW_DEBUG=1 ;;
|
||||||
-*)
|
-*)
|
||||||
[[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1
|
[[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
REPOS+=("${option}")
|
REPOS+=("${option}")
|
||||||
|
@ -77,7 +77,7 @@ repo_var() {
|
|||||||
local repo_var
|
local repo_var
|
||||||
|
|
||||||
repo_var="$1"
|
repo_var="$1"
|
||||||
if [[ "${repo_var}" = "${HOMEBREW_REPOSITORY}" ]]
|
if [[ "${repo_var}" == "${HOMEBREW_REPOSITORY}" ]]
|
||||||
then
|
then
|
||||||
repo_var=""
|
repo_var=""
|
||||||
else
|
else
|
||||||
@ -193,16 +193,18 @@ merge_or_rebase() {
|
|||||||
|
|
||||||
trap reset_on_interrupt SIGINT
|
trap reset_on_interrupt SIGINT
|
||||||
|
|
||||||
if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
|
if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
|
||||||
then
|
then
|
||||||
UPSTREAM_TAG="$(git tag --list |
|
UPSTREAM_TAG="$(
|
||||||
|
git tag --list |
|
||||||
sort --field-separator=. --key=1,1nr -k 2,2nr -k 3,3nr |
|
sort --field-separator=. --key=1,1nr -k 2,2nr -k 3,3nr |
|
||||||
grep --max-count=1 '^[0-9]*\.[0-9]*\.[0-9]*$')"
|
grep --max-count=1 '^[0-9]*\.[0-9]*\.[0-9]*$'
|
||||||
|
)"
|
||||||
else
|
else
|
||||||
UPSTREAM_TAG=""
|
UPSTREAM_TAG=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${UPSTREAM_TAG}" ]
|
if [[ -n "${UPSTREAM_TAG}" ]]
|
||||||
then
|
then
|
||||||
REMOTE_REF="refs/tags/${UPSTREAM_TAG}"
|
REMOTE_REF="refs/tags/${UPSTREAM_TAG}"
|
||||||
UPSTREAM_BRANCH="stable"
|
UPSTREAM_BRANCH="stable"
|
||||||
@ -288,8 +290,8 @@ EOS
|
|||||||
|
|
||||||
if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]]
|
if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]]
|
||||||
then
|
then
|
||||||
if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" &&
|
if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]] &&
|
||||||
! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]]
|
[[ ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]]
|
||||||
then
|
then
|
||||||
git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}"
|
git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}"
|
||||||
fi
|
fi
|
||||||
@ -310,7 +312,7 @@ homebrew-update() {
|
|||||||
for option in "$@"
|
for option in "$@"
|
||||||
do
|
do
|
||||||
case "${option}" in
|
case "${option}" in
|
||||||
-\?|-h|--help|--usage) brew help update; exit $? ;;
|
-\? | -h | --help | --usage) brew help update; exit $? ;;
|
||||||
--verbose) HOMEBREW_VERBOSE=1 ;;
|
--verbose) HOMEBREW_VERBOSE=1 ;;
|
||||||
--debug) HOMEBREW_DEBUG=1 ;;
|
--debug) HOMEBREW_DEBUG=1 ;;
|
||||||
--quiet) HOMEBREW_QUIET=1 ;;
|
--quiet) HOMEBREW_QUIET=1 ;;
|
||||||
@ -320,10 +322,10 @@ homebrew-update() {
|
|||||||
--preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
|
--preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
|
||||||
--*) ;;
|
--*) ;;
|
||||||
-*)
|
-*)
|
||||||
[[ "${option}" = *v* ]] && HOMEBREW_VERBOSE=1
|
[[ "${option}" == *v* ]] && HOMEBREW_VERBOSE=1
|
||||||
[[ "${option}" = *q* ]] && HOMEBREW_QUIET=1
|
[[ "${option}" == *q* ]] && HOMEBREW_QUIET=1
|
||||||
[[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1
|
[[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1
|
||||||
[[ "${option}" = *f* ]] && HOMEBREW_UPDATE_FORCE=1
|
[[ "${option}" == *f* ]] && HOMEBREW_UPDATE_FORCE=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
@ -371,8 +373,7 @@ EOS
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# we may want to use a Homebrew curl
|
# we may want to use a Homebrew curl
|
||||||
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" &&
|
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && ! -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]]
|
||||||
! -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]]
|
|
||||||
then
|
then
|
||||||
# we cannot install a Homebrew cURL if homebrew/core is unavailable.
|
# we cannot install a Homebrew cURL if homebrew/core is unavailable.
|
||||||
if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install curl
|
if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install curl
|
||||||
@ -382,8 +383,7 @@ EOS
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! git --version &>/dev/null ||
|
if ! git --version &>/dev/null ||
|
||||||
[[ -n "${HOMEBREW_FORCE_BREWED_GIT}" &&
|
[[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && ! -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]]
|
||||||
! -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]]
|
|
||||||
then
|
then
|
||||||
# we cannot install a Homebrew Git if homebrew/core is unavailable.
|
# we cannot install a Homebrew Git if homebrew/core is unavailable.
|
||||||
if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install git
|
if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install git
|
||||||
@ -394,7 +394,7 @@ EOS
|
|||||||
|
|
||||||
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1
|
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1
|
||||||
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1
|
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1
|
||||||
if [[ -n ${HOMEBREW_CORE_SHALLOW} && -n ${HOMEBREW_CASK_SHALLOW} ]]
|
if [[ -n "${HOMEBREW_CORE_SHALLOW}" && -n "${HOMEBREW_CASK_SHALLOW}" ]]
|
||||||
then
|
then
|
||||||
SHALLOW_COMMAND_PHRASE="These commands"
|
SHALLOW_COMMAND_PHRASE="These commands"
|
||||||
SHALLOW_REPO_PHRASE="repositories"
|
SHALLOW_REPO_PHRASE="repositories"
|
||||||
@ -403,7 +403,7 @@ EOS
|
|||||||
SHALLOW_REPO_PHRASE="repository"
|
SHALLOW_REPO_PHRASE="repository"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${HOMEBREW_CORE_SHALLOW} || -n ${HOMEBREW_CASK_SHALLOW} ]]
|
if [[ -n "${HOMEBREW_CORE_SHALLOW}" || -n "${HOMEBREW_CASK_SHALLOW}" ]]
|
||||||
then
|
then
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
${HOMEBREW_CORE_SHALLOW:+
|
${HOMEBREW_CORE_SHALLOW:+
|
||||||
@ -480,9 +480,8 @@ EOS
|
|||||||
safe_cd "${HOMEBREW_REPOSITORY}"
|
safe_cd "${HOMEBREW_REPOSITORY}"
|
||||||
|
|
||||||
# if an older system had a newer curl installed, change each repo's remote URL from GIT to HTTPS
|
# if an older system had a newer curl installed, change each repo's remote URL from GIT to HTTPS
|
||||||
if [[ -n "${HOMEBREW_SYSTEM_CURL_TOO_OLD}" &&
|
if [[ -n "${HOMEBREW_SYSTEM_CURL_TOO_OLD}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
|
||||||
-x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" &&
|
[[ "$(git config remote.origin.url)" =~ ^git:// ]]
|
||||||
"$(git config remote.origin.url)" =~ ^git:// ]]
|
|
||||||
then
|
then
|
||||||
git config remote.origin.url "${HOMEBREW_BREW_GIT_REMOTE}"
|
git config remote.origin.url "${HOMEBREW_BREW_GIT_REMOTE}"
|
||||||
git config -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/config" remote.origin.url "${HOMEBREW_CORE_GIT_REMOTE}"
|
git config -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/config" remote.origin.url "${HOMEBREW_CORE_GIT_REMOTE}"
|
||||||
@ -498,8 +497,9 @@ EOS
|
|||||||
|
|
||||||
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
|
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
|
||||||
do
|
do
|
||||||
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
|
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
|
||||||
[[ "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]]
|
[[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
|
||||||
|
[[ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]]
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -518,15 +518,15 @@ EOS
|
|||||||
declare PREFETCH_REVISION"${TAP_VAR}"="$(git rev-parse -q --verify refs/remotes/origin/"${UPSTREAM_BRANCH_DIR}")"
|
declare PREFETCH_REVISION"${TAP_VAR}"="$(git rev-parse -q --verify refs/remotes/origin/"${UPSTREAM_BRANCH_DIR}")"
|
||||||
|
|
||||||
# Force a full update if we don't have any tags.
|
# Force a full update if we don't have any tags.
|
||||||
if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -z "$(git tag --list)" ]]
|
if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && -z "$(git tag --list)" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_UPDATE_FORCE=1
|
HOMEBREW_UPDATE_FORCE=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${HOMEBREW_UPDATE_FORCE}" ]]
|
if [[ -z "${HOMEBREW_UPDATE_FORCE}" ]]
|
||||||
then
|
then
|
||||||
[[ -n "${SKIP_FETCH_BREW_REPOSITORY}" && "${DIR}" = "${HOMEBREW_REPOSITORY}" ]] && continue
|
[[ -n "${SKIP_FETCH_BREW_REPOSITORY}" && "${DIR}" == "${HOMEBREW_REPOSITORY}" ]] && continue
|
||||||
[[ -n "${SKIP_FETCH_CORE_REPOSITORY}" && "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] && continue
|
[[ -n "${SKIP_FETCH_CORE_REPOSITORY}" && "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] && continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The upstream repository's default branch may not be master;
|
# The upstream repository's default branch may not be master;
|
||||||
@ -538,12 +538,12 @@ EOS
|
|||||||
|
|
||||||
# HOMEBREW_UPDATE_FORCE and HOMEBREW_UPDATE_PREINSTALL aren't modified here so ignore subshell warning.
|
# HOMEBREW_UPDATE_FORCE and HOMEBREW_UPDATE_PREINSTALL aren't modified here so ignore subshell warning.
|
||||||
# shellcheck disable=SC2030
|
# shellcheck disable=SC2030
|
||||||
if [[ "${UPSTREAM_REPOSITORY_URL}" = "https://github.com/"* ]]
|
if [[ "${UPSTREAM_REPOSITORY_URL}" == "https://github.com/"* ]]
|
||||||
then
|
then
|
||||||
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}"
|
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}"
|
||||||
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY%.git}"
|
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY%.git}"
|
||||||
|
|
||||||
if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
|
if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
|
||||||
then
|
then
|
||||||
# Only try to `git fetch` when the upstream tags have changed
|
# Only try to `git fetch` when the upstream tags have changed
|
||||||
# (so the API does not return 304: unmodified).
|
# (so the API does not return 304: unmodified).
|
||||||
@ -560,7 +560,8 @@ EOS
|
|||||||
|
|
||||||
# HOMEBREW_CURL is set by brew.sh (and isn't mispelt here)
|
# HOMEBREW_CURL is set by brew.sh (and isn't mispelt here)
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
UPSTREAM_SHA_HTTP_CODE="$("${HOMEBREW_CURL}" \
|
UPSTREAM_SHA_HTTP_CODE="$(
|
||||||
|
"${HOMEBREW_CURL}" \
|
||||||
"${CURL_DISABLE_CURLRC_ARGS[@]}" \
|
"${CURL_DISABLE_CURLRC_ARGS[@]}" \
|
||||||
--silent --max-time 3 \
|
--silent --max-time 3 \
|
||||||
--location --no-remote-time --output /dev/null --write-out "%{http_code}" \
|
--location --no-remote-time --output /dev/null --write-out "%{http_code}" \
|
||||||
@ -568,11 +569,12 @@ EOS
|
|||||||
--user-agent "${HOMEBREW_USER_AGENT_CURL}" \
|
--user-agent "${HOMEBREW_USER_AGENT_CURL}" \
|
||||||
--header "Accept: ${GITHUB_API_ACCEPT}" \
|
--header "Accept: ${GITHUB_API_ACCEPT}" \
|
||||||
--header "If-None-Match: \"${GITHUB_API_ETAG}\"" \
|
--header "If-None-Match: \"${GITHUB_API_ETAG}\"" \
|
||||||
"https://api.github.com/repos/${UPSTREAM_REPOSITORY}/${GITHUB_API_ENDPOINT}")"
|
"https://api.github.com/repos/${UPSTREAM_REPOSITORY}/${GITHUB_API_ENDPOINT}"
|
||||||
|
)"
|
||||||
|
|
||||||
# Touch FETCH_HEAD to confirm we've checked for an update.
|
# Touch FETCH_HEAD to confirm we've checked for an update.
|
||||||
[[ -f "${DIR}/.git/FETCH_HEAD" ]] && touch "${DIR}/.git/FETCH_HEAD"
|
[[ -f "${DIR}/.git/FETCH_HEAD" ]] && touch "${DIR}/.git/FETCH_HEAD"
|
||||||
[[ -z "${HOMEBREW_UPDATE_FORCE}" ]] && [[ "${UPSTREAM_SHA_HTTP_CODE}" = "304" ]] && exit
|
[[ -z "${HOMEBREW_UPDATE_FORCE}" ]] && [[ "${UPSTREAM_SHA_HTTP_CODE}" == "304" ]] && exit
|
||||||
elif [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]]
|
elif [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]]
|
||||||
then
|
then
|
||||||
FORCE_AUTO_UPDATE="$(git config homebrew.forceautoupdate 2>/dev/null || echo "false")"
|
FORCE_AUTO_UPDATE="$(git config homebrew.forceautoupdate 2>/dev/null || echo "false")"
|
||||||
@ -583,7 +585,6 @@ EOS
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# HOMEBREW_VERBOSE isn't modified here so ignore subshell warning.
|
# HOMEBREW_VERBOSE isn't modified here so ignore subshell warning.
|
||||||
# shellcheck disable=SC2030
|
# shellcheck disable=SC2030
|
||||||
if [[ -n "${HOMEBREW_VERBOSE}" ]]
|
if [[ -n "${HOMEBREW_VERBOSE}" ]]
|
||||||
@ -606,7 +607,7 @@ EOS
|
|||||||
# Reprint fetch errors to stderr
|
# Reprint fetch errors to stderr
|
||||||
[[ -f "${tmp_failure_file}" ]] && cat "${tmp_failure_file}" 1>&2
|
[[ -f "${tmp_failure_file}" ]] && cat "${tmp_failure_file}" 1>&2
|
||||||
|
|
||||||
if [[ "${UPSTREAM_SHA_HTTP_CODE}" = "404" ]]
|
if [[ "${UPSTREAM_SHA_HTTP_CODE}" == "404" ]]
|
||||||
then
|
then
|
||||||
TAP="${DIR#${HOMEBREW_LIBRARY}/Taps/}"
|
TAP="${DIR#${HOMEBREW_LIBRARY}/Taps/}"
|
||||||
echo "${TAP} does not exist! Run \`brew untap ${TAP}\` to remove it." >>"${update_failed_file}"
|
echo "${TAP} does not exist! Run \`brew untap ${TAP}\` to remove it." >>"${update_failed_file}"
|
||||||
@ -614,7 +615,7 @@ EOS
|
|||||||
echo "Fetching ${DIR} failed!" >>"${update_failed_file}"
|
echo "Fetching ${DIR} failed!" >>"${update_failed_file}"
|
||||||
|
|
||||||
if [[ -f "${tmp_failure_file}" ]] &&
|
if [[ -f "${tmp_failure_file}" ]] &&
|
||||||
[[ "$(<"${tmp_failure_file}")" = "fatal: couldn't find remote ref refs/heads/${UPSTREAM_BRANCH_DIR}" ]]
|
[[ "$(cat "${tmp_failure_file}")" == "fatal: couldn't find remote ref refs/heads/${UPSTREAM_BRANCH_DIR}" ]]
|
||||||
then
|
then
|
||||||
echo "${DIR}" >>"${missing_remote_ref_dirs_file}"
|
echo "${DIR}" >>"${missing_remote_ref_dirs_file}"
|
||||||
fi
|
fi
|
||||||
@ -638,7 +639,7 @@ EOS
|
|||||||
|
|
||||||
if [[ -f "${missing_remote_ref_dirs_file}" ]]
|
if [[ -f "${missing_remote_ref_dirs_file}" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_MISSING_REMOTE_REF_DIRS="$(<"${missing_remote_ref_dirs_file}")"
|
HOMEBREW_MISSING_REMOTE_REF_DIRS="$(cat "${missing_remote_ref_dirs_file}")"
|
||||||
rm -f "${missing_remote_ref_dirs_file}"
|
rm -f "${missing_remote_ref_dirs_file}"
|
||||||
export HOMEBREW_MISSING_REMOTE_REF_DIRS
|
export HOMEBREW_MISSING_REMOTE_REF_DIRS
|
||||||
fi
|
fi
|
||||||
@ -647,9 +648,10 @@ EOS
|
|||||||
do
|
do
|
||||||
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
|
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
|
||||||
# shellcheck disable=SC2031
|
# shellcheck disable=SC2031
|
||||||
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
|
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
|
||||||
[[ "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ||
|
[[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
|
||||||
"${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]]
|
[[ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" || \
|
||||||
|
"${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]]
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -672,8 +674,8 @@ EOS
|
|||||||
then
|
then
|
||||||
simulate_from_current_branch "${DIR}" "${TAP_VAR}" "${UPSTREAM_BRANCH}" "${CURRENT_REVISION}"
|
simulate_from_current_branch "${DIR}" "${TAP_VAR}" "${UPSTREAM_BRANCH}" "${CURRENT_REVISION}"
|
||||||
elif [[ -z "${HOMEBREW_UPDATE_FORCE}" ]] &&
|
elif [[ -z "${HOMEBREW_UPDATE_FORCE}" ]] &&
|
||||||
[[ "${PREFETCH_REVISION}" = "${POSTFETCH_REVISION}" ]] &&
|
[[ "${PREFETCH_REVISION}" == "${POSTFETCH_REVISION}" ]] &&
|
||||||
[[ "${CURRENT_REVISION}" = "${POSTFETCH_REVISION}" ]]
|
[[ "${CURRENT_REVISION}" == "${POSTFETCH_REVISION}" ]]
|
||||||
then
|
then
|
||||||
export HOMEBREW_UPDATE_BEFORE"${TAP_VAR}"="${CURRENT_REVISION}"
|
export HOMEBREW_UPDATE_BEFORE"${TAP_VAR}"="${CURRENT_REVISION}"
|
||||||
export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}"
|
export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}"
|
||||||
@ -687,18 +689,17 @@ EOS
|
|||||||
|
|
||||||
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
|
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
|
||||||
# shellcheck disable=SC2031
|
# shellcheck disable=SC2031
|
||||||
if [[ -n "${HOMEBREW_UPDATED}" ||
|
if [[ -n "${HOMEBREW_UPDATED}" ]] ||
|
||||||
-n "${HOMEBREW_UPDATE_FAILED}" ||
|
[[ -n "${HOMEBREW_UPDATE_FAILED}" ]] ||
|
||||||
-n "${HOMEBREW_MISSING_REMOTE_REF_DIRS}" ||
|
[[ -n "${HOMEBREW_MISSING_REMOTE_REF_DIRS}" ]] ||
|
||||||
-n "${HOMEBREW_UPDATE_FORCE}" ||
|
[[ -n "${HOMEBREW_UPDATE_FORCE}" ]] ||
|
||||||
-d "${HOMEBREW_LIBRARY}/LinkedKegs" ||
|
[[ -d "${HOMEBREW_LIBRARY}/LinkedKegs" ]] ||
|
||||||
! -f "${HOMEBREW_CACHE}/all_commands_list.txt" ||
|
[[ ! -f "${HOMEBREW_CACHE}/all_commands_list.txt" ]] ||
|
||||||
(-n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_PREINSTALL}") ]]
|
[[ -n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_PREINSTALL}" ]]
|
||||||
then
|
then
|
||||||
brew update-report "$@"
|
brew update-report "$@"
|
||||||
return $?
|
return $?
|
||||||
elif [[ -z "${HOMEBREW_UPDATE_PREINSTALL}" &&
|
elif [[ -z "${HOMEBREW_UPDATE_PREINSTALL}" && -z "${HOMEBREW_QUIET}" ]]
|
||||||
-z "${HOMEBREW_QUIET}" ]]
|
|
||||||
then
|
then
|
||||||
echo "Already up-to-date."
|
echo "Already up-to-date."
|
||||||
fi
|
fi
|
||||||
|
@ -14,7 +14,7 @@ VENDOR_DIR="${HOMEBREW_LIBRARY}/Homebrew/vendor"
|
|||||||
# Built from https://github.com/Homebrew/homebrew-portable-ruby.
|
# Built from https://github.com/Homebrew/homebrew-portable-ruby.
|
||||||
if [[ -n "${HOMEBREW_MACOS}" ]]
|
if [[ -n "${HOMEBREW_MACOS}" ]]
|
||||||
then
|
then
|
||||||
if [[ "${HOMEBREW_PROCESSOR}" = "Intel" ]]
|
if [[ "${HOMEBREW_PROCESSOR}" == "Intel" ]]
|
||||||
then
|
then
|
||||||
ruby_FILENAME="portable-ruby-2.6.3_2.yosemite.bottle.tar.gz"
|
ruby_FILENAME="portable-ruby-2.6.3_2.yosemite.bottle.tar.gz"
|
||||||
ruby_SHA="b065e5e3783954f3e65d8d3a6377ca51649bfcfa21b356b0dd70490f74c6bd86"
|
ruby_SHA="b065e5e3783954f3e65d8d3a6377ca51649bfcfa21b356b0dd70490f74c6bd86"
|
||||||
@ -26,7 +26,7 @@ then
|
|||||||
ruby_FILENAME="portable-ruby-2.6.3_2.x86_64_linux.bottle.tar.gz"
|
ruby_FILENAME="portable-ruby-2.6.3_2.x86_64_linux.bottle.tar.gz"
|
||||||
ruby_SHA="97e639a64dcec285392b53ad804b5334c324f1d2a8bdc2b5087b8bf8051e332f"
|
ruby_SHA="97e639a64dcec285392b53ad804b5334c324f1d2a8bdc2b5087b8bf8051e332f"
|
||||||
;;
|
;;
|
||||||
*)
|
*) ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -43,13 +43,15 @@ then
|
|||||||
then
|
then
|
||||||
ruby_URLs+=("${HOMEBREW_BOTTLE_DOMAIN}/bottles-portable-ruby/${ruby_FILENAME}")
|
ruby_URLs+=("${HOMEBREW_BOTTLE_DOMAIN}/bottles-portable-ruby/${ruby_FILENAME}")
|
||||||
fi
|
fi
|
||||||
ruby_URLs+=("https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}"
|
ruby_URLs+=(
|
||||||
"https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/${ruby_FILENAME}")
|
"https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}"
|
||||||
|
"https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/${ruby_FILENAME}"
|
||||||
|
)
|
||||||
ruby_URL="${ruby_URLs[0]}"
|
ruby_URL="${ruby_URLs[0]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_linux_glibc_version() {
|
check_linux_glibc_version() {
|
||||||
if [[ -z ${HOMEBREW_LINUX} || -z ${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION} ]]
|
if [[ -z "${HOMEBREW_LINUX}" || -z "${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION}" ]]
|
||||||
then
|
then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -58,15 +60,15 @@ check_linux_glibc_version() {
|
|||||||
local glibc_version_major
|
local glibc_version_major
|
||||||
local glibc_version_minor
|
local glibc_version_minor
|
||||||
|
|
||||||
local minimum_required_major=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION%.*}
|
local minimum_required_major="${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION%.*}"
|
||||||
local minimum_required_minor=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION#*.}
|
local minimum_required_minor="${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION#*.}"
|
||||||
|
|
||||||
if [[ $(/usr/bin/ldd --version) =~ \ [0-9]\.[0-9]+ ]]
|
if [[ "$(/usr/bin/ldd --version)" =~ \ [0-9]\.[0-9]+ ]]
|
||||||
then
|
then
|
||||||
glibc_version=${BASH_REMATCH[0]// /}
|
glibc_version="${BASH_REMATCH[0]// /}"
|
||||||
glibc_version_major=${glibc_version%.*}
|
glibc_version_major="${glibc_version%.*}"
|
||||||
glibc_version_minor=${glibc_version#*.}
|
glibc_version_minor="${glibc_version#*.}"
|
||||||
if (( glibc_version_major < minimum_required_major || glibc_version_minor < minimum_required_minor ))
|
if ((glibc_version_major < minimum_required_major || glibc_version_minor < minimum_required_minor))
|
||||||
then
|
then
|
||||||
odie "Vendored tools require system Glibc ${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION} or later (yours is ${glibc_version})."
|
odie "Vendored tools require system Glibc ${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION} or later (yours is ${glibc_version})."
|
||||||
fi
|
fi
|
||||||
@ -77,7 +79,8 @@ check_linux_glibc_version() {
|
|||||||
|
|
||||||
# Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set.
|
# Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set.
|
||||||
quiet_stderr() {
|
quiet_stderr() {
|
||||||
if [[ -z "${HOMEBREW_STDERR}" ]]; then
|
if [[ -z "${HOMEBREW_STDERR}" ]]
|
||||||
|
then
|
||||||
command "$@" 2>/dev/null
|
command "$@" 2>/dev/null
|
||||||
else
|
else
|
||||||
command "$@"
|
command "$@"
|
||||||
@ -180,13 +183,14 @@ EOS
|
|||||||
sha="$(sha256sum "${CACHED_LOCATION}" | cut -d' ' -f1)"
|
sha="$(sha256sum "${CACHED_LOCATION}" | cut -d' ' -f1)"
|
||||||
elif [[ -x "$(type -P ruby)" ]]
|
elif [[ -x "$(type -P ruby)" ]]
|
||||||
then
|
then
|
||||||
sha="$(ruby <<EOSCRIPT
|
sha="$(
|
||||||
require 'digest/sha2'
|
ruby <<EOSCRIPT
|
||||||
digest = Digest::SHA256.new
|
require 'digest/sha2'
|
||||||
File.open('${CACHED_LOCATION}', 'rb') { |f| digest.update(f.read) }
|
digest = Digest::SHA256.new
|
||||||
puts digest.hexdigest
|
File.open('${CACHED_LOCATION}', 'rb') { |f| digest.update(f.read) }
|
||||||
|
puts digest.hexdigest
|
||||||
EOSCRIPT
|
EOSCRIPT
|
||||||
)"
|
)"
|
||||||
else
|
else
|
||||||
odie "Cannot verify checksum ('shasum' or 'sha256sum' not found)!"
|
odie "Cannot verify checksum ('shasum' or 'sha256sum' not found)!"
|
||||||
fi
|
fi
|
||||||
@ -261,9 +265,9 @@ homebrew-vendor-install() {
|
|||||||
--debug) HOMEBREW_DEBUG=1 ;;
|
--debug) HOMEBREW_DEBUG=1 ;;
|
||||||
--*) ;;
|
--*) ;;
|
||||||
-*)
|
-*)
|
||||||
[[ "${option}" = *v* ]] && HOMEBREW_VERBOSE=1
|
[[ "${option}" == *v* ]] && HOMEBREW_VERBOSE=1
|
||||||
[[ "${option}" = *q* ]] && HOMEBREW_QUIET=1
|
[[ "${option}" == *q* ]] && HOMEBREW_QUIET=1
|
||||||
[[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1
|
[[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
[[ -n "${VENDOR_NAME}" ]] && odie "This command does not take multiple vendor targets!"
|
[[ -n "${VENDOR_NAME}" ]] && odie "This command does not take multiple vendor targets!"
|
||||||
@ -282,7 +286,7 @@ homebrew-vendor-install() {
|
|||||||
VENDOR_FILENAME="${!filename_var}"
|
VENDOR_FILENAME="${!filename_var}"
|
||||||
VENDOR_SHA="${!sha_var}"
|
VENDOR_SHA="${!sha_var}"
|
||||||
VENDOR_URL="${!url_var}"
|
VENDOR_URL="${!url_var}"
|
||||||
VENDOR_VERSION="$(<"${VENDOR_DIR}/portable-${VENDOR_NAME}-version")"
|
VENDOR_VERSION="$(cat "${VENDOR_DIR}/portable-${VENDOR_NAME}-version")"
|
||||||
|
|
||||||
if [[ -z "${VENDOR_URL}" || -z "${VENDOR_SHA}" ]]
|
if [[ -z "${VENDOR_URL}" || -z "${VENDOR_SHA}" ]]
|
||||||
then
|
then
|
||||||
@ -292,7 +296,7 @@ homebrew-vendor-install() {
|
|||||||
# Expand the name to an array of variables
|
# Expand the name to an array of variables
|
||||||
# The array name must be "${VENDOR_NAME}_URLs"! Otherwise substitution errors will occur!
|
# The array name must be "${VENDOR_NAME}_URLs"! Otherwise substitution errors will occur!
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
read -r -a VENDOR_URLs <<< "$(eval "echo "\$\{${url_var}s[@]\}"")"
|
read -r -a VENDOR_URLs <<<"$(eval "echo "\$\{${url_var}s[@]\}"")"
|
||||||
|
|
||||||
CACHED_LOCATION="${HOMEBREW_CACHE}/${VENDOR_FILENAME}"
|
CACHED_LOCATION="${HOMEBREW_CACHE}/${VENDOR_FILENAME}"
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ homebrew-rubocop() {
|
|||||||
GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')"
|
GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')"
|
||||||
GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}"
|
GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}"
|
||||||
|
|
||||||
if ! [[ -f "${GEM_HOME}/bin/rubocop" ]]; then
|
if ! [[ -f "${GEM_HOME}/bin/rubocop" ]]
|
||||||
|
then
|
||||||
"${HOMEBREW_BREW_FILE}" install-bundler-gems
|
"${HOMEBREW_BREW_FILE}" install-bundler-gems
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
homebrew-items() {
|
homebrew-items() {
|
||||||
local items
|
local items
|
||||||
local sed_extended_regex_flag
|
local sed_extended_regex_flag
|
||||||
local find_filter=$1
|
local find_filter="$1"
|
||||||
local sed_filter=$2
|
local sed_filter="$2"
|
||||||
local grep_filter=$3
|
local grep_filter="$3"
|
||||||
|
|
||||||
# HOMEBREW_MACOS is set by brew.sh
|
# HOMEBREW_MACOS is set by brew.sh
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ -n "${HOMEBREW_MACOS}" ]]; then
|
if [[ -n "${HOMEBREW_MACOS}" ]]
|
||||||
|
then
|
||||||
sed_extended_regex_flag="-E"
|
sed_extended_regex_flag="-E"
|
||||||
else
|
else
|
||||||
sed_extended_regex_flag="-r"
|
sed_extended_regex_flag="-r"
|
||||||
@ -15,7 +16,7 @@ homebrew-items() {
|
|||||||
|
|
||||||
# HOMEBREW_REPOSITORY is set by brew.sh
|
# HOMEBREW_REPOSITORY is set by brew.sh
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
items="$( \
|
items="$(
|
||||||
find "${HOMEBREW_REPOSITORY}/Library/Taps" \
|
find "${HOMEBREW_REPOSITORY}/Library/Taps" \
|
||||||
-type d \( \
|
-type d \( \
|
||||||
-name "${find_filter}" -o \
|
-name "${find_filter}" -o \
|
||||||
@ -25,15 +26,15 @@ homebrew-items() {
|
|||||||
-name spec -o \
|
-name spec -o \
|
||||||
-name vendor \
|
-name vendor \
|
||||||
\) \
|
\) \
|
||||||
-prune -false -o -name '*\.rb' | \
|
-prune -false -o -name '*\.rb' |
|
||||||
sed "${sed_extended_regex_flag}" \
|
sed "${sed_extended_regex_flag}" \
|
||||||
-e 's/\.rb//g' \
|
-e 's/\.rb//g' \
|
||||||
-e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
|
-e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
|
||||||
-e "${sed_filter}" \
|
-e "${sed_filter}"
|
||||||
)"
|
)"
|
||||||
local shortnames
|
local shortnames
|
||||||
shortnames="$(echo "${items}" | cut -d "/" -f 3)"
|
shortnames="$(echo "${items}" | cut -d "/" -f 3)"
|
||||||
echo -e "${items}\n${shortnames}" | \
|
echo -e "${items}\n${shortnames}" |
|
||||||
grep -v "${grep_filter}" | \
|
grep -v "${grep_filter}" |
|
||||||
sort -uf
|
sort -uf
|
||||||
}
|
}
|
||||||
|
@ -5,20 +5,27 @@
|
|||||||
# HOMEBREW_PREFIX and HOMEBREW_REPOSITORY are set by brew.sh
|
# HOMEBREW_PREFIX and HOMEBREW_REPOSITORY are set by brew.sh
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
homebrew-prefix() {
|
homebrew-prefix() {
|
||||||
while [[ "$#" -gt 0 ]]; do
|
while [[ "$#" -gt 0 ]]
|
||||||
case $1 in
|
do
|
||||||
|
case "$1" in
|
||||||
# check we actually have --prefix and not e.g. --prefixsomething
|
# check we actually have --prefix and not e.g. --prefixsomething
|
||||||
--prefix) local prefix="1"; shift ;;
|
--prefix)
|
||||||
|
local prefix="1"; shift
|
||||||
|
;;
|
||||||
# reject all other flags
|
# reject all other flags
|
||||||
-*) return 1 ;;
|
-*) return 1 ;;
|
||||||
*) [ -n "${formula}" ] && return 1; local formula="$1"; shift ;;
|
*)
|
||||||
|
[[ -n "${formula}" ]] && return 1
|
||||||
|
local formula="$1"; shift
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
[ -z "${prefix}" ] && return 1
|
[[ -z "${prefix}" ]] && return 1
|
||||||
[ -z "${formula}" ] && echo "${HOMEBREW_PREFIX}" && return 0
|
[[ -z "${formula}" ]] && echo "${HOMEBREW_PREFIX}" && return 0
|
||||||
|
|
||||||
local formula_path
|
local formula_path
|
||||||
if [ -f "${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb" ]; then
|
if [[ -f "${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb" ]]
|
||||||
|
then
|
||||||
formula_path="${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb"
|
formula_path="${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb"
|
||||||
else
|
else
|
||||||
formula_path="$(
|
formula_path="$(
|
||||||
@ -26,7 +33,7 @@ homebrew-prefix() {
|
|||||||
echo "${HOMEBREW_REPOSITORY}/Library/Taps"/*/*/{Formula/,HomebrewFormula/,}"${formula}.rb"
|
echo "${HOMEBREW_REPOSITORY}/Library/Taps"/*/*/{Formula/,HomebrewFormula/,}"${formula}.rb"
|
||||||
)"
|
)"
|
||||||
fi
|
fi
|
||||||
[ -z "${formula_path}" ] && return 1
|
[[ -z "${formula_path}" ]] && return 1
|
||||||
|
|
||||||
echo "${HOMEBREW_PREFIX}/opt/${formula}"
|
echo "${HOMEBREW_PREFIX}/opt/${formula}"
|
||||||
return 0
|
return 0
|
||||||
|
@ -4,10 +4,16 @@
|
|||||||
# HOMEBREW_LIBRARY is set by bin/brew
|
# HOMEBREW_LIBRARY is set by bin/brew
|
||||||
# shellcheck disable=SC2154,SC2250
|
# shellcheck disable=SC2154,SC2250
|
||||||
pathremove() {
|
pathremove() {
|
||||||
local IFS=':' NEWPATH="" DIR="" PATHVARIABLE=${2:-PATH}
|
local IFS=':'
|
||||||
for DIR in ${!PATHVARIABLE} ; do
|
local NEWPATH=""
|
||||||
if [ "${DIR}" != "$1" ] ; then
|
local DIR=""
|
||||||
NEWPATH=${NEWPATH:+$NEWPATH:}${DIR}
|
local PATHVARIABLE="${2:-PATH}"
|
||||||
|
|
||||||
|
for DIR in ${!PATHVARIABLE}
|
||||||
|
do
|
||||||
|
if [[ "${DIR}" != "$1" ]]
|
||||||
|
then
|
||||||
|
NEWPATH="${NEWPATH:+$NEWPATH:}${DIR}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
export "${PATHVARIABLE}"="${NEWPATH}"
|
export "${PATHVARIABLE}"="${NEWPATH}"
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
pkg_config="${HOMEBREW_OPT}/pkg-config/bin/pkg-config"
|
pkg_config="${HOMEBREW_OPT}/pkg-config/bin/pkg-config"
|
||||||
|
|
||||||
if [ -z "${HOMEBREW_SDKROOT}" ]; then
|
if [[ -z "${HOMEBREW_SDKROOT}" ]]
|
||||||
|
then
|
||||||
exec "${pkg_config}" "$@"
|
exec "${pkg_config}" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@ source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
|||||||
|
|
||||||
try_exec_non_system "${SHIM_FILE}" "$@"
|
try_exec_non_system "${SHIM_FILE}" "$@"
|
||||||
|
|
||||||
if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]; then
|
if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]
|
||||||
export SDKROOT=${HOMEBREW_SDKROOT}
|
then
|
||||||
|
export SDKROOT="${HOMEBREW_SDKROOT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
safe_exec "/usr/bin/${SHIM_FILE}" "$@"
|
safe_exec "/usr/bin/${SHIM_FILE}" "$@"
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
||||||
|
|
||||||
if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]; then
|
if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]
|
||||||
export SDKROOT=${HOMEBREW_SDKROOT}
|
then
|
||||||
|
export SDKROOT="${HOMEBREW_SDKROOT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
try_exec_non_system "swift" "$@"
|
try_exec_non_system "swift" "$@"
|
||||||
|
@ -7,18 +7,21 @@
|
|||||||
# These could be used in conjunction with `--sdk` which ignores SDKROOT.
|
# These could be used in conjunction with `--sdk` which ignores SDKROOT.
|
||||||
# HOMEBREW_DEVELOPER_DIR, HOMEBREW_SDKROOT and HOMEBREW_PREFER_CLT_PROXIES are set by extend/ENV/super.rb
|
# HOMEBREW_DEVELOPER_DIR, HOMEBREW_SDKROOT and HOMEBREW_PREFER_CLT_PROXIES are set by extend/ENV/super.rb
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ "$*" =~ (^| )-?-show-sdk-(path|version|build) && -n "${HOMEBREW_DEVELOPER_DIR}" ]]; then
|
if [[ "$*" =~ (^| )-?-show-sdk-(path|version|build) && -n "${HOMEBREW_DEVELOPER_DIR}" ]]
|
||||||
export DEVELOPER_DIR=${HOMEBREW_DEVELOPER_DIR}
|
then
|
||||||
|
export DEVELOPER_DIR="${HOMEBREW_DEVELOPER_DIR}"
|
||||||
else
|
else
|
||||||
# Some build tools set DEVELOPER_DIR, so discard it
|
# Some build tools set DEVELOPER_DIR, so discard it
|
||||||
unset DEVELOPER_DIR
|
unset DEVELOPER_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]; then
|
if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]
|
||||||
export SDKROOT=${HOMEBREW_SDKROOT}
|
then
|
||||||
|
export SDKROOT="${HOMEBREW_SDKROOT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [[ $# -eq 0 ]]
|
||||||
|
then
|
||||||
exec /usr/bin/xcrun "$@"
|
exec /usr/bin/xcrun "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -27,38 +30,45 @@ case "$1" in
|
|||||||
-*) exec /usr/bin/xcrun "$@" ;;
|
-*) exec /usr/bin/xcrun "$@" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
arg0=$1
|
arg0="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
exe="/usr/bin/${arg0}"
|
exe="/usr/bin/${arg0}"
|
||||||
if [[ -x "${exe}" ]]; then
|
if [[ -x "${exe}" ]]
|
||||||
if [[ -n "${HOMEBREW_PREFER_CLT_PROXIES}" ]]; then
|
then
|
||||||
|
if [[ -n "${HOMEBREW_PREFER_CLT_PROXIES}" ]]
|
||||||
|
then
|
||||||
exec "${exe}" "$@"
|
exec "${exe}" "$@"
|
||||||
elif [[ -z "${HOMEBREW_SDKROOT}" || ! -d "${HOMEBREW_SDKROOT}" ]]; then
|
elif [[ -z "${HOMEBREW_SDKROOT}" || ! -d "${HOMEBREW_SDKROOT}" ]]
|
||||||
|
then
|
||||||
exec "${exe}" "$@"
|
exec "${exe}" "$@"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SUPERBIN=$(cd "${0%/*}" && pwd -P)
|
SUPERBIN="$(cd "${0%/*}" && pwd -P)"
|
||||||
|
|
||||||
exe=$(/usr/bin/xcrun --find "${arg0}" 2>/dev/null)
|
exe="$(/usr/bin/xcrun --find "${arg0}" 2>/dev/null)"
|
||||||
if [[ -x "${exe}" && "${exe%/*}" != "${SUPERBIN}" ]]; then
|
if [[ -x "${exe}" && "${exe%/*}" != "${SUPERBIN}" ]]
|
||||||
|
then
|
||||||
exec "${exe}" "$@"
|
exec "${exe}" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
old_IFS=${IFS}
|
old_IFS="${IFS}"
|
||||||
IFS=:
|
IFS=':'
|
||||||
for path in ${PATH}; do
|
for path in ${PATH}
|
||||||
if [ "${path}" = "${SUPERBIN}" ]; then
|
do
|
||||||
|
if [[ "${path}" == "${SUPERBIN}" ]]
|
||||||
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exe="${path}/${arg0}"
|
exe="${path}/${arg0}"
|
||||||
if [ -x "${exe}" ]; then
|
if [[ -x "${exe}" ]]
|
||||||
|
then
|
||||||
exec "${exe}" "$@"
|
exec "${exe}" "$@"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS=${old_IFS}
|
IFS="${old_IFS}"
|
||||||
|
|
||||||
echo >&2 "
|
echo >&2 "
|
||||||
Failed to execute ${arg0} ${*}
|
Failed to execute ${arg0} ${*}
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
# SHIM_FILE is set by shims/utils.sh
|
# SHIM_FILE is set by shims/utils.sh
|
||||||
# HOMEBREW_GIT is set by brew.sh
|
# HOMEBREW_GIT is set by brew.sh
|
||||||
# HOMEBREW_SVN is from the user environment.
|
# HOMEBREW_SVN is from the user environment.
|
||||||
# HOMEBREW_PREFIX is set extend/ENV/super.rb
|
# HOMEBREW_PREFIX is set by extend/ENV/super.rb
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [ -z "${HOMEBREW_LIBRARY}" ]
|
if [[ -z "${HOMEBREW_LIBRARY}" ]]
|
||||||
then
|
then
|
||||||
echo "${0##*/}: This shim is internal and must be run via brew." >&2
|
echo "${0##*/}: This shim is internal and must be run via brew." >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Make sure this shim uses the same Ruby interpreter that is used by Homebrew.
|
# Make sure this shim uses the same Ruby interpreter that is used by Homebrew.
|
||||||
if [ -z "$HOMEBREW_RUBY_PATH" ]
|
if [[ -z "${HOMEBREW_RUBY_PATH}" ]]
|
||||||
then
|
then
|
||||||
echo "${0##*/}: The build tool has reset ENV; --env=std required." >&2
|
echo "${0##*/}: The build tool has reset ENV; --env=std required." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exec "$HOMEBREW_RUBY_PATH" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -x "$0" "$@"
|
exec "${HOMEBREW_RUBY_PATH}" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -x "$0" "$@"
|
||||||
#!/usr/bin/env ruby -W0
|
#!/usr/bin/env ruby -W0
|
||||||
|
|
||||||
require "pathname"
|
require "pathname"
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
set +o posix
|
set +o posix
|
||||||
|
|
||||||
quiet_safe_cd() {
|
quiet_safe_cd() {
|
||||||
cd "$1" &>/dev/null || { echo "Error: failed to cd to $1" >&2; exit 1; }
|
cd "$1" &>/dev/null || {
|
||||||
|
echo "Error: failed to cd to $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absdir() {
|
absdir() {
|
||||||
@ -25,7 +28,7 @@ realpath() {
|
|||||||
while [[ -L "${path}" ]]
|
while [[ -L "${path}" ]]
|
||||||
do
|
do
|
||||||
dest="$(readlink "${path}")"
|
dest="$(readlink "${path}")"
|
||||||
if [[ "${dest}" = "/"* ]]
|
if [[ "${dest}" == "/"* ]]
|
||||||
then
|
then
|
||||||
path="${dest}"
|
path="${dest}"
|
||||||
else
|
else
|
||||||
@ -54,11 +57,11 @@ safe_exec() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
# prevent fork-bombs
|
# prevent fork-bombs
|
||||||
if [[ "$(lowercase "${arg0}")" = "${SHIM_FILE}" || "$(realpath "${arg0}")" = "${SHIM_REAL}" ]]
|
if [[ "$(lowercase "${arg0}")" == "${SHIM_FILE}" || "$(realpath "${arg0}")" == "${SHIM_REAL}" ]]
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ "${HOMEBREW}" = "print-path" ]]
|
if [[ "${HOMEBREW}" == "print-path" ]]
|
||||||
then
|
then
|
||||||
local dir
|
local dir
|
||||||
dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
||||||
@ -74,22 +77,20 @@ try_exec_non_system() {
|
|||||||
local file="$1"
|
local file="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
IFS=$'\n'
|
local path
|
||||||
for path in $(type -aP "${file}")
|
while read -r path
|
||||||
do
|
do
|
||||||
if [[ "${path}" != "/usr/bin/${file}" ]]
|
if [[ "${path}" != "/usr/bin/${file}" ]]
|
||||||
then
|
then
|
||||||
safe_exec "${path}" "$@"
|
safe_exec "${path}" "$@"
|
||||||
fi
|
fi
|
||||||
done
|
done < <(type -aP "${file}")
|
||||||
unset IFS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SHIM_FILE="${0##*/}"
|
SHIM_FILE="${0##*/}"
|
||||||
SHIM_REAL="$(realpath "$0")"
|
SHIM_REAL="$(realpath "$0")"
|
||||||
|
|
||||||
if [[ "$1" = --homebrew=* ]]
|
if [[ "$1" == "--homebrew="* ]]
|
||||||
then
|
then
|
||||||
HOMEBREW="${1:11}"
|
HOMEBREW="${1:11}"
|
||||||
shift
|
shift
|
||||||
|
@ -10,7 +10,7 @@ migrate-legacy-uuid-file() {
|
|||||||
|
|
||||||
if [[ -f "${legacy_uuid_file}" ]]
|
if [[ -f "${legacy_uuid_file}" ]]
|
||||||
then
|
then
|
||||||
analytics_uuid="$(<"${legacy_uuid_file}")"
|
analytics_uuid="$(cat "${legacy_uuid_file}")"
|
||||||
if [[ -n "${analytics_uuid}" ]]
|
if [[ -n "${analytics_uuid}" ]]
|
||||||
then
|
then
|
||||||
git config --file="${HOMEBREW_REPOSITORY}/.git/config" --replace-all homebrew.analyticsuuid "${analytics_uuid}" 2>/dev/null
|
git config --file="${HOMEBREW_REPOSITORY}/.git/config" --replace-all homebrew.analyticsuuid "${analytics_uuid}" 2>/dev/null
|
||||||
@ -32,7 +32,7 @@ setup-analytics() {
|
|||||||
local message_seen analytics_disabled
|
local message_seen analytics_disabled
|
||||||
message_seen="$(git config --file="${git_config_file}" --get homebrew.analyticsmessage 2>/dev/null)"
|
message_seen="$(git config --file="${git_config_file}" --get homebrew.analyticsmessage 2>/dev/null)"
|
||||||
analytics_disabled="$(git config --file="${git_config_file}" --get homebrew.analyticsdisabled 2>/dev/null)"
|
analytics_disabled="$(git config --file="${git_config_file}" --get homebrew.analyticsdisabled 2>/dev/null)"
|
||||||
if [[ "${message_seen}" != "true" || "${analytics_disabled}" = "true" ]]
|
if [[ "${message_seen}" != "true" || "${analytics_disabled}" == "true" ]]
|
||||||
then
|
then
|
||||||
# Internal variable for brew's use, to differentiate from user-supplied setting
|
# Internal variable for brew's use, to differentiate from user-supplied setting
|
||||||
export HOMEBREW_NO_ANALYTICS_THIS_RUN="1"
|
export HOMEBREW_NO_ANALYTICS_THIS_RUN="1"
|
||||||
|
@ -8,7 +8,7 @@ lock() {
|
|||||||
local lock_dir="${HOMEBREW_PREFIX}/var/homebrew/locks"
|
local lock_dir="${HOMEBREW_PREFIX}/var/homebrew/locks"
|
||||||
local lock_file="${lock_dir}/${name}"
|
local lock_file="${lock_dir}/${name}"
|
||||||
[[ -d "${lock_dir}" ]] || mkdir -p "${lock_dir}"
|
[[ -d "${lock_dir}" ]] || mkdir -p "${lock_dir}"
|
||||||
if ! [[ -w "${lock_dir}" ]]
|
if [[ ! -w "${lock_dir}" ]]
|
||||||
then
|
then
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
Can't create ${name} lock in ${lock_dir}!
|
Can't create ${name} lock in ${lock_dir}!
|
||||||
|
@ -8,7 +8,7 @@ which_all() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local executable entries entry retcode=1
|
local executable entries entry retcode=1
|
||||||
IFS=':' read -r -a entries <<< "${PATH}" # `readarray -d ':' -t` seems not applicable on WSL Bash
|
IFS=':' read -r -a entries <<<"${PATH}" # `readarray -d ':' -t` seems not applicable on WSL Bash
|
||||||
for entry in "${entries[@]}"
|
for entry in "${entries[@]}"
|
||||||
do
|
do
|
||||||
executable="${entry}/$1"
|
executable="${entry}/$1"
|
||||||
@ -46,7 +46,8 @@ find_ruby() {
|
|||||||
local ruby_exec
|
local ruby_exec
|
||||||
while read -r ruby_exec
|
while read -r ruby_exec
|
||||||
do
|
do
|
||||||
if test_ruby "${ruby_exec}"; then
|
if test_ruby "${ruby_exec}"
|
||||||
|
then
|
||||||
echo "${ruby_exec}"
|
echo "${ruby_exec}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -90,7 +91,7 @@ setup-ruby-path() {
|
|||||||
local upgrade_fail
|
local upgrade_fail
|
||||||
local install_fail
|
local install_fail
|
||||||
|
|
||||||
if [[ -n ${HOMEBREW_MACOS} ]]
|
if [[ -n "${HOMEBREW_MACOS}" ]]
|
||||||
then
|
then
|
||||||
upgrade_fail="Failed to upgrade Homebrew Portable Ruby!"
|
upgrade_fail="Failed to upgrade Homebrew Portable Ruby!"
|
||||||
install_fail="Failed to install Homebrew Portable Ruby (and your system version is too old)!"
|
install_fail="Failed to install Homebrew Portable Ruby (and your system version is too old)!"
|
||||||
@ -109,8 +110,8 @@ If there's no Homebrew Portable Ruby available for your processor:
|
|||||||
vendor_ruby_root="${vendor_dir}/portable-ruby/current"
|
vendor_ruby_root="${vendor_dir}/portable-ruby/current"
|
||||||
vendor_ruby_path="${vendor_ruby_root}/bin/ruby"
|
vendor_ruby_path="${vendor_ruby_root}/bin/ruby"
|
||||||
vendor_ruby_terminfo="${vendor_ruby_root}/share/terminfo"
|
vendor_ruby_terminfo="${vendor_ruby_root}/share/terminfo"
|
||||||
vendor_ruby_latest_version=$(<"${vendor_dir}/portable-ruby-version")
|
vendor_ruby_latest_version="$(cat "${vendor_dir}/portable-ruby-version")"
|
||||||
vendor_ruby_current_version=$(readlink "${vendor_ruby_root}")
|
vendor_ruby_current_version="$(readlink "${vendor_ruby_root}")"
|
||||||
|
|
||||||
unset HOMEBREW_RUBY_PATH
|
unset HOMEBREW_RUBY_PATH
|
||||||
|
|
||||||
@ -123,12 +124,12 @@ If there's no Homebrew Portable Ruby available for your processor:
|
|||||||
then
|
then
|
||||||
HOMEBREW_RUBY_PATH="${vendor_ruby_path}"
|
HOMEBREW_RUBY_PATH="${vendor_ruby_path}"
|
||||||
TERMINFO_DIRS="${vendor_ruby_terminfo}"
|
TERMINFO_DIRS="${vendor_ruby_terminfo}"
|
||||||
if [[ ${vendor_ruby_current_version} != "${vendor_ruby_latest_version}" ]]
|
if [[ "${vendor_ruby_current_version}" != "${vendor_ruby_latest_version}" ]]
|
||||||
then
|
then
|
||||||
brew vendor-install ruby || odie "${upgrade_fail}"
|
brew vendor-install ruby || odie "${upgrade_fail}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
HOMEBREW_RUBY_PATH=$(find_ruby)
|
HOMEBREW_RUBY_PATH="$(find_ruby)"
|
||||||
if need_vendored_ruby
|
if need_vendored_ruby
|
||||||
then
|
then
|
||||||
brew vendor-install ruby || odie "${install_fail}"
|
brew vendor-install ruby || odie "${install_fail}"
|
||||||
|
2
bin/brew
2
bin/brew
@ -114,7 +114,7 @@ then
|
|||||||
# Skip if variable value is empty.
|
# Skip if variable value is empty.
|
||||||
[[ -z "${!VAR}" ]] && continue
|
[[ -z "${!VAR}" ]] && continue
|
||||||
|
|
||||||
FILTERED_ENV+=( "${VAR}=${!VAR}" )
|
FILTERED_ENV+=("${VAR}=${!VAR}")
|
||||||
done
|
done
|
||||||
|
|
||||||
exec /usr/bin/env -i "${FILTERED_ENV[@]}" /bin/bash "${HOMEBREW_LIBRARY}/Homebrew/brew.sh" "$@"
|
exec /usr/bin/env -i "${FILTERED_ENV[@]}" /bin/bash "${HOMEBREW_LIBRARY}/Homebrew/brew.sh" "$@"
|
||||||
|
@ -17,14 +17,14 @@ After running `brew update`, you receive a Git error warning about untracked fil
|
|||||||
This is caused by an old bug in in the `update` code that has long since been fixed. However, the nature of the bug requires that you do the following:
|
This is caused by an old bug in in the `update` code that has long since been fixed. However, the nature of the bug requires that you do the following:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd $(brew --repository)
|
cd "$(brew --repository)"
|
||||||
git reset --hard FETCH_HEAD
|
git reset --hard FETCH_HEAD
|
||||||
```
|
```
|
||||||
|
|
||||||
If `brew doctor` still complains about uncommitted modifications, also run this command:
|
If `brew doctor` still complains about uncommitted modifications, also run this command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd $(brew --repository)/Library
|
cd "$(brew --repository)/Library"
|
||||||
git clean -fd
|
git clean -fd
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ Please report this bug:
|
|||||||
This happens because an old version of the upgrade command is hanging around for some reason. The fix:
|
This happens because an old version of the upgrade command is hanging around for some reason. The fix:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd $(brew --repository)/Library/Contributions/examples
|
cd "$(brew --repository)/Library/Contributions/examples"
|
||||||
git clean -n # if this doesn't list anything that you want to keep, then
|
git clean -n # if this doesn't list anything that you want to keep, then
|
||||||
git clean -f # this will remove untracked files
|
git clean -f # this will remove untracked files
|
||||||
```
|
```
|
||||||
|
@ -55,7 +55,7 @@ Homebrew doesn't support arbitrary mixing and matching of formula versions, so e
|
|||||||
Which is usually: `~/Library/Caches/Homebrew`
|
Which is usually: `~/Library/Caches/Homebrew`
|
||||||
|
|
||||||
## My Mac `.app`s don’t find Homebrew utilities!
|
## My Mac `.app`s don’t find Homebrew utilities!
|
||||||
GUI apps on macOS don’t have Homebrew's prefix in their `PATH` by default. If you're on Mountain Lion or later, you can fix this by running `sudo launchctl config user path "$(brew --prefix)/bin:$PATH"` and then rebooting, as documented in `man launchctl`. Note that this sets the launchctl `PATH` for *all users*. For earlier versions of macOS, see [this page](https://developer.apple.com/legacy/library/qa/qa1067/_index.html).
|
GUI apps on macOS don’t have Homebrew's prefix in their `PATH` by default. If you're on Mountain Lion or later, you can fix this by running `sudo launchctl config user path "$(brew --prefix)/bin:${PATH}"` and then rebooting, as documented in `man launchctl`. Note that this sets the launchctl `PATH` for *all users*. For earlier versions of macOS, see [this page](https://developer.apple.com/legacy/library/qa/qa1067/_index.html).
|
||||||
|
|
||||||
## How do I contribute to Homebrew?
|
## How do I contribute to Homebrew?
|
||||||
Read our [contribution guidelines](https://github.com/Homebrew/brew/blob/HEAD/CONTRIBUTING.md#contributing-to-homebrew).
|
Read our [contribution guidelines](https://github.com/Homebrew/brew/blob/HEAD/CONTRIBUTING.md#contributing-to-homebrew).
|
||||||
@ -84,7 +84,7 @@ We aim to bottle everything.
|
|||||||
```sh
|
```sh
|
||||||
brew install hub
|
brew install hub
|
||||||
brew update
|
brew update
|
||||||
cd $(brew --repository)
|
cd "$(brew --repository)"
|
||||||
hub pull someone_else
|
hub pull someone_else
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ Everything is built on Git, so contribution is easy:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew update # required in more ways than you think (initialises the brew git repository if you don't already have it)
|
brew update # required in more ways than you think (initialises the brew git repository if you don't already have it)
|
||||||
cd $(brew --repository homebrew/core)
|
cd "$(brew --repository homebrew/core)"
|
||||||
# Create a new git branch for your formula so your pull request is easy to
|
# Create a new git branch for your formula so your pull request is easy to
|
||||||
# modify if any changes come up during review.
|
# modify if any changes come up during review.
|
||||||
git checkout -b <some-descriptive-name> origin/master
|
git checkout -b <some-descriptive-name> origin/master
|
||||||
|
@ -118,7 +118,7 @@ Then put the appropriate incantation in your shell’s startup, e.g. for
|
|||||||
[`local::lib`](https://metacpan.org/pod/local::lib) docs.
|
[`local::lib`](https://metacpan.org/pod/local::lib) docs.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
|
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
|
||||||
```
|
```
|
||||||
|
|
||||||
Now (after you restart your shell) `cpan` or `perl -MCPAN -eshell` etc.
|
Now (after you restart your shell) `cpan` or `perl -MCPAN -eshell` etc.
|
||||||
|
@ -77,7 +77,7 @@ For brewed Python, modules installed with `pip3` or `python3 setup.py install` w
|
|||||||
The system Python may not know which compiler flags to set in order to build bindings for software installed in Homebrew so you may need to run:
|
The system Python may not know which compiler flags to set in order to build bindings for software installed in Homebrew so you may need to run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
CFLAGS=-I$(brew --prefix)/include LDFLAGS=-L$(brew --prefix)/lib pip install <package>
|
CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib" pip install <package>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Virtualenv
|
## Virtualenv
|
||||||
|
@ -44,9 +44,9 @@ variable, or let `hub fork` add a remote for you.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install hub
|
brew install hub
|
||||||
cd $(brew --repository homebrew/core)
|
cd "$(brew --repository homebrew/core)"
|
||||||
git remote add homebrew https://github.com/Homebrew/homebrew-core.git
|
git remote add homebrew https://github.com/Homebrew/homebrew-core.git
|
||||||
hub fork --remote-name=$HOMEBREW_GITHUB_USER
|
hub fork --remote-name="${HOMEBREW_GITHUB_USER}"
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, let's make sure that our local branch `master` is clean and that
|
Now, let's make sure that our local branch `master` is clean and that
|
||||||
@ -56,7 +56,7 @@ your fork is up-to-date with Homebrew/linuxbrew-core:
|
|||||||
git checkout master
|
git checkout master
|
||||||
git fetch origin master
|
git fetch origin master
|
||||||
git reset --hard origin/master
|
git reset --hard origin/master
|
||||||
git push --force $HOMEBREW_GITHUB_USER master
|
git push --force "${HOMEBREW_GITHUB_USER}" master
|
||||||
```
|
```
|
||||||
|
|
||||||
Strictly speaking, there is no need for `git reset --hard
|
Strictly speaking, there is no need for `git reset --hard
|
||||||
@ -220,8 +220,9 @@ manually, tap `Homebrew/homebrew-linux-dev` and run the following
|
|||||||
command where the merge commit is `HEAD`:
|
command where the merge commit is `HEAD`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
for formula in $(brew find-formulae-to-bottle); do
|
for formula in $(brew find-formulae-to-bottle)
|
||||||
brew request-bottle $formula
|
do
|
||||||
|
brew request-bottle "${formula}"
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ The prefix `/home/linuxbrew/.linuxbrew` was chosen so that users without admin a
|
|||||||
Follow the *Next steps* instructions to add Homebrew to your `PATH` and to your bash shell profile script, either `~/.profile` on Debian/Ubuntu or `~/.bash_profile` on CentOS/Fedora/Red Hat.
|
Follow the *Next steps* instructions to add Homebrew to your `PATH` and to your bash shell profile script, either `~/.profile` on Debian/Ubuntu or `~/.bash_profile` on CentOS/Fedora/Red Hat.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
|
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
|
||||||
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
|
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||||
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
|
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.bash_profile
|
||||||
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
|
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.profile
|
||||||
```
|
```
|
||||||
|
|
||||||
You're done! Try installing a package:
|
You're done! Try installing a package:
|
||||||
@ -86,7 +86,7 @@ Extract or `git clone` Homebrew wherever you want. Use `/home/linuxbrew/.linuxbr
|
|||||||
git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
|
git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
|
||||||
mkdir ~/.linuxbrew/bin
|
mkdir ~/.linuxbrew/bin
|
||||||
ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
|
ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
|
||||||
eval $(~/.linuxbrew/bin/brew shellenv)
|
eval "$(~/.linuxbrew/bin/brew shellenv)"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Homebrew on Linux Community
|
## Homebrew on Linux Community
|
||||||
|
@ -15,7 +15,7 @@ Depending on the change you want to make, you need to send the pull request to t
|
|||||||
* This creates a personal remote repository that you can push to. This is needed because only Homebrew maintainers have push access to the main repositories.
|
* This creates a personal remote repository that you can push to. This is needed because only Homebrew maintainers have push access to the main repositories.
|
||||||
2. Change to the directory containing your Homebrew installation:
|
2. Change to the directory containing your Homebrew installation:
|
||||||
```sh
|
```sh
|
||||||
cd $(brew --repository)
|
cd "$(brew --repository)"
|
||||||
```
|
```
|
||||||
3. Add your pushable forked repository as a new remote:
|
3. Add your pushable forked repository as a new remote:
|
||||||
```sh
|
```sh
|
||||||
@ -29,7 +29,7 @@ Depending on the change you want to make, you need to send the pull request to t
|
|||||||
* This creates a personal remote repository that you can push to. This is needed because only Homebrew maintainers have push access to the main repositories.
|
* This creates a personal remote repository that you can push to. This is needed because only Homebrew maintainers have push access to the main repositories.
|
||||||
2. Change to the directory containing Homebrew formulae:
|
2. Change to the directory containing Homebrew formulae:
|
||||||
```sh
|
```sh
|
||||||
cd $(brew --repository homebrew/core)
|
cd "$(brew --repository homebrew/core)"
|
||||||
```
|
```
|
||||||
3. Add your pushable forked repository as a new remote:
|
3. Add your pushable forked repository as a new remote:
|
||||||
```sh
|
```sh
|
||||||
|
@ -27,13 +27,13 @@ Useful, reliable alternatives exist should you wish to use `keg_only` tools outs
|
|||||||
You can set flags to give configure scripts or Makefiles a nudge in the right direction. An example of flag setting:
|
You can set flags to give configure scripts or Makefiles a nudge in the right direction. An example of flag setting:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./configure --prefix=/Users/Dave/Downloads CFLAGS=-I$(brew --prefix)/opt/openssl/include LDFLAGS=-L$(brew --prefix)/opt/openssl/lib
|
./configure --prefix=/Users/Dave/Downloads CFLAGS="-I$(brew --prefix)/opt/openssl/include" LDFLAGS="-L$(brew --prefix)/opt/openssl/lib"
|
||||||
```
|
```
|
||||||
|
|
||||||
An example using `pip`:
|
An example using `pip`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
CFLAGS=-I$(brew --prefix)/opt/icu4c/include LDFLAGS=-L$(brew --prefix)/opt/icu4c/lib pip install pyicu
|
CFLAGS="-I$(brew --prefix)/opt/icu4c/include" LDFLAGS="-L$(brew --prefix)/opt/icu4c/lib" pip install pyicu
|
||||||
```
|
```
|
||||||
|
|
||||||
### `PATH` modification
|
### `PATH` modification
|
||||||
@ -41,7 +41,7 @@ CFLAGS=-I$(brew --prefix)/opt/icu4c/include LDFLAGS=-L$(brew --prefix)/opt/icu4c
|
|||||||
You can temporarily prepend your `PATH` with the tool’s `bin` directory, such as:
|
You can temporarily prepend your `PATH` with the tool’s `bin` directory, such as:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
export PATH=$(brew --prefix)/opt/openssl/bin:$PATH
|
export PATH="$(brew --prefix)/opt/openssl/bin:${PATH}"
|
||||||
```
|
```
|
||||||
|
|
||||||
This will prepend that folder to your `PATH`, ensuring any build script that searches the `PATH` will find it first.
|
This will prepend that folder to your `PATH`, ensuring any build script that searches the `PATH` will find it first.
|
||||||
@ -55,7 +55,7 @@ If the tool you are attempting to build is [pkg-config](https://en.wikipedia.org
|
|||||||
An example of this is:
|
An example of this is:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
export PKG_CONFIG_PATH=$(brew --prefix)/opt/openssl/lib/pkgconfig
|
export PKG_CONFIG_PATH="$(brew --prefix)/opt/openssl/lib/pkgconfig"
|
||||||
```
|
```
|
||||||
|
|
||||||
If you’re curious about the `PKG_CONFIG_PATH` variable `man pkg-config` goes into more detail.
|
If you’re curious about the `PKG_CONFIG_PATH` variable `man pkg-config` goes into more detail.
|
||||||
|
@ -572,7 +572,7 @@ Print export statements. When run in a shell, this installation of Homebrew will
|
|||||||
|
|
||||||
The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
|
The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
|
||||||
The variable `HOMEBREW_SHELLENV_PREFIX` will be exported to avoid adding duplicate entries to the environment variables.
|
The variable `HOMEBREW_SHELLENV_PREFIX` will be exported to avoid adding duplicate entries to the environment variables.
|
||||||
Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)`
|
Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval "$(brew shellenv)"`
|
||||||
|
|
||||||
### `tap` [*`options`*] [*`user`*`/`*`repo`*] [*`URL`*]
|
### `tap` [*`options`*] [*`user`*`/`*`repo`*] [*`URL`*]
|
||||||
|
|
||||||
|
@ -13,13 +13,16 @@ Shell completions for external Homebrew commands are not automatically installed
|
|||||||
To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` (or, if it doesn't exist, `~/.profile`):
|
To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` (or, if it doesn't exist, `~/.profile`):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
if type brew &>/dev/null; then
|
if type brew &>/dev/null
|
||||||
|
then
|
||||||
HOMEBREW_PREFIX="$(brew --prefix)"
|
HOMEBREW_PREFIX="$(brew --prefix)"
|
||||||
if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then
|
if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]
|
||||||
|
then
|
||||||
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
|
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
|
||||||
else
|
else
|
||||||
for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*; do
|
for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*
|
||||||
[[ -r "$COMPLETION" ]] && source "$COMPLETION"
|
do
|
||||||
|
[[ -r "${COMPLETION}" ]] && source "${COMPLETION}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -35,8 +38,9 @@ If you are using the `bash` formula as your shell (i.e. `bash` >= v4) you should
|
|||||||
To make Homebrew's completions available in `zsh`, you must get the Homebrew-managed zsh site-functions on your `FPATH` before initialising `zsh`'s completion facility. Add the following to your `~/.zshrc` file:
|
To make Homebrew's completions available in `zsh`, you must get the Homebrew-managed zsh site-functions on your `FPATH` before initialising `zsh`'s completion facility. Add the following to your `~/.zshrc` file:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
if type brew &>/dev/null; then
|
if type brew &>/dev/null
|
||||||
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
|
then
|
||||||
|
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||||
|
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit
|
compinit
|
||||||
@ -46,7 +50,7 @@ fi
|
|||||||
This must be done before `compinit` is called. Note that if you are using Oh My Zsh, it will call `compinit` for you, so this must be done before you call `oh-my-zsh.sh`. This may be done by appending the following line to your `~/.zprofile` after Homebrew's initialization, instead of modifying your `~/.zshrc` as above:
|
This must be done before `compinit` is called. Note that if you are using Oh My Zsh, it will call `compinit` for you, so this must be done before you call `oh-my-zsh.sh`. This may be done by appending the following line to your `~/.zprofile` after Homebrew's initialization, instead of modifying your `~/.zshrc` as above:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
|
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||||
```
|
```
|
||||||
|
|
||||||
You may also need to forcibly rebuild `zcompdump`:
|
You may also need to forcibly rebuild `zcompdump`:
|
||||||
|
@ -28,14 +28,14 @@ In the case of Erlang, this requires renaming the file from `otp_src_R13B03` to
|
|||||||
|
|
||||||
`brew --cache -s erlang` will print the correct name of the cached
|
`brew --cache -s erlang` will print the correct name of the cached
|
||||||
download. This means instead of manually renaming a formula, you can
|
download. This means instead of manually renaming a formula, you can
|
||||||
run `mv the_tarball $(brew --cache -s <formula>)`.
|
run `mv the_tarball "$(brew --cache -s <formula>)"`.
|
||||||
|
|
||||||
You can also pre-cache the download by using the command `brew fetch <formula>` which also displays the SHA-256 hash. This can be useful for updating formulae to new versions.
|
You can also pre-cache the download by using the command `brew fetch <formula>` which also displays the SHA-256 hash. This can be useful for updating formulae to new versions.
|
||||||
|
|
||||||
## Installing stuff without the Xcode CLT
|
## Installing stuff without the Xcode CLT
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew sh # or: eval $(brew --env)
|
brew sh # or: eval "$(brew --env)"
|
||||||
gem install ronn # or c-programs
|
gem install ronn # or c-programs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "BREW" "1" "August 2021" "Homebrew" "brew"
|
.TH "BREW" "1" "September 2021" "Homebrew" "brew"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\fR \- The Missing Package Manager for macOS (or Linux)
|
\fBbrew\fR \- The Missing Package Manager for macOS (or Linux)
|
||||||
@ -796,7 +796,7 @@ Search for \fItext\fR in the given database\.
|
|||||||
Print export statements\. When run in a shell, this installation of Homebrew will be added to your \fBPATH\fR, \fBMANPATH\fR, and \fBINFOPATH\fR\.
|
Print export statements\. When run in a shell, this installation of Homebrew will be added to your \fBPATH\fR, \fBMANPATH\fR, and \fBINFOPATH\fR\.
|
||||||
.
|
.
|
||||||
.P
|
.P
|
||||||
The variables \fBHOMEBREW_PREFIX\fR, \fBHOMEBREW_CELLAR\fR and \fBHOMEBREW_REPOSITORY\fR are also exported to avoid querying them multiple times\. The variable \fBHOMEBREW_SHELLENV_PREFIX\fR will be exported to avoid adding duplicate entries to the environment variables\. Consider adding evaluation of this command\'s output to your dotfiles (e\.g\. \fB~/\.profile\fR, \fB~/\.bash_profile\fR, or \fB~/\.zprofile\fR) with: \fBeval $(brew shellenv)\fR
|
The variables \fBHOMEBREW_PREFIX\fR, \fBHOMEBREW_CELLAR\fR and \fBHOMEBREW_REPOSITORY\fR are also exported to avoid querying them multiple times\. The variable \fBHOMEBREW_SHELLENV_PREFIX\fR will be exported to avoid adding duplicate entries to the environment variables\. Consider adding evaluation of this command\'s output to your dotfiles (e\.g\. \fB~/\.profile\fR, \fB~/\.bash_profile\fR, or \fB~/\.zprofile\fR) with: \fBeval "$(brew shellenv)"\fR
|
||||||
.
|
.
|
||||||
.SS "\fBtap\fR [\fIoptions\fR] [\fIuser\fR\fB/\fR\fIrepo\fR] [\fIURL\fR]"
|
.SS "\fBtap\fR [\fIoptions\fR] [\fIuser\fR\fB/\fR\fIrepo\fR] [\fIURL\fR]"
|
||||||
Tap a formula repository\.
|
Tap a formula repository\.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user