From 540313f18b28fe69bb5cb82ca080568aefaf250d Mon Sep 17 00:00:00 2001
From: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com>
Date: Sun, 19 Jun 2022 16:49:14 -0400
Subject: [PATCH 1/5] support custom git SSH binaries
---
Library/Homebrew/brew.sh | 21 ++++++++++++++++++++-
bin/brew | 1 +
docs/Manpage.md | 8 ++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh
index cbe08846a2..a6e123a620 100644
--- a/Library/Homebrew/brew.sh
+++ b/Library/Homebrew/brew.sh
@@ -396,8 +396,25 @@ setup_git() {
fi
}
+setup_ssh() {
+ # This is set by the user environment.
+ # shellcheck disable=SC2154
+ HOMEBREW_BREWED_SSH_PATH="${HOMEBREW_PREFIX}/opt/openssh/bin/ssh"
+ if [[ -n "${HOMEBREW_FORCE_BREWED_SSH}" && -x "${HOMEBREW_BREWED_SSH_PATH}" ]] &&
+ "${HOMEBREW_BREWED_SSH_PATH}" -V &>/dev/null
+ then
+ HOMEBREW_SSH="${HOMEBREW_BREWED_SSH_PATH}"
+ elif [[ -n "${HOMEBREW_SSH_PATH}" ]]
+ then
+ HOMEBREW_SSH="${HOMEBREW_SSH_PATH}"
+ else
+ HOMEBREW_SSH="ssh"
+ fi
+}
+
setup_curl
setup_git
+setup_ssh
HOMEBREW_VERSION="$("${HOMEBREW_GIT}" -C "${HOMEBREW_REPOSITORY}" describe --tags --dirty --abbrev=7 2>/dev/null)"
HOMEBREW_USER_AGENT_VERSION="${HOMEBREW_VERSION}"
@@ -795,7 +812,9 @@ setup-analytics
# Use this configuration file instead of ~/.ssh/config when fetching git over SSH.
if [[ -n "${HOMEBREW_SSH_CONFIG_PATH}" ]]
then
- export GIT_SSH_COMMAND="ssh -F${HOMEBREW_SSH_CONFIG_PATH}"
+ export GIT_SSH_COMMAND="${HOMEBREW_SSH} -F${HOMEBREW_SSH_CONFIG_PATH}"
+else
+ export GIT_SSH_COMMAND="${HOMEBREW_SSH}"
fi
if [[ -n "${HOMEBREW_DOCKER_REGISTRY_TOKEN}" ]]
diff --git a/bin/brew b/bin/brew
index 4c06f135a0..1bd34f63d2 100755
--- a/bin/brew
+++ b/bin/brew
@@ -121,6 +121,7 @@ then
http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY
GITHUB_ACTIONS GITHUB_WORKSPACE GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED
GITHUB_REPOSITORY GITHUB_RUN_ID GITHUB_SHA GITHUB_HEAD_REF GITHUB_BASE_REF GITHUB_REF
+ GIT_SSH
# TODO: remove the below after a few days
GITHUB_ACTIONS_HOMEBREW_MACOS_SELF_HOSTED
)
diff --git a/docs/Manpage.md b/docs/Manpage.md
index 0b90444e43..22db08fa59 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -2058,6 +2058,9 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_FORCE_BREWED_GIT`
If set, always use a Homebrew-installed `git`(1) rather than the system version. Automatically set if the system version of `git` is too old.
+- `HOMEBREW_FORCE_BREWED_SSH`
+
If set, always use a Homebrew-installed `openssh`(1) rather than the system version.
+
- `HOMEBREW_FORCE_VENDOR_RUBY`
If set, always use Homebrew's vendored, relocatable Ruby version even if the system version of Ruby is new enough.
@@ -2170,6 +2173,11 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
*Default:* `$HOME/.ssh/config`
+- `HOMEBREW_SSH_PATH`
+
Set this value to a new enough `ssh` executable for Homebrew to use.
+
+ *Default:* `ssh`.
+
- `HOMEBREW_SKIP_OR_LATER_BOTTLES`
If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions of macOS. This is useful in development on new macOS versions.
From bcce038d3324bca351a64c7f505829efb83da125 Mon Sep 17 00:00:00 2001
From: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com>
Date: Sun, 19 Jun 2022 18:19:28 -0400
Subject: [PATCH 2/5] update env_config.rb
---
Library/Homebrew/env_config.rb | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb
index 237c307731..567f875f08 100644
--- a/Library/Homebrew/env_config.rb
+++ b/Library/Homebrew/env_config.rb
@@ -170,6 +170,10 @@ module Homebrew
"Automatically set if the system version of `git` is too old.",
boolean: true,
},
+ HOMEBREW_FORCE_BREWED_SSH: {
+ description: "If set, always use a Homebrew-installed `ssh`(1) rather than the system version. ",
+ boolean: true,
+ },
HOMEBREW_FORCE_VENDOR_RUBY: {
description: "If set, always use Homebrew's vendored, relocatable Ruby version even if the system version " \
"of Ruby is new enough.",
@@ -320,6 +324,10 @@ module Homebrew
"`git` repos over `ssh`.",
default_text: "`$HOME/.ssh/config`",
},
+ HOMEBREW_SSH_PATH: {
+ description: "Set this value to a new enough `ssh` executable for Homebrew to use.",
+ default_text: "ssh",
+ },
HOMEBREW_SKIP_OR_LATER_BOTTLES: {
description: "If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions " \
"of macOS. This is useful in development on new macOS versions.",
From 631c245be559c2544b0d3203b58377d1e777b5eb Mon Sep 17 00:00:00 2001
From: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com>
Date: Sun, 19 Jun 2022 18:21:20 -0400
Subject: [PATCH 3/5] revert bin/brew change
---
bin/brew | 1 -
1 file changed, 1 deletion(-)
diff --git a/bin/brew b/bin/brew
index 1bd34f63d2..4c06f135a0 100755
--- a/bin/brew
+++ b/bin/brew
@@ -121,7 +121,6 @@ then
http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY
GITHUB_ACTIONS GITHUB_WORKSPACE GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED
GITHUB_REPOSITORY GITHUB_RUN_ID GITHUB_SHA GITHUB_HEAD_REF GITHUB_BASE_REF GITHUB_REF
- GIT_SSH
# TODO: remove the below after a few days
GITHUB_ACTIONS_HOMEBREW_MACOS_SELF_HOSTED
)
From 8d76522be2601a9b1955ac957e839a381ffb5e72 Mon Sep 17 00:00:00 2001
From: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com>
Date: Wed, 22 Jun 2022 19:19:22 -0400
Subject: [PATCH 4/5] remove HOMEBREW_SSH_PATH
---
Library/Homebrew/brew.sh | 3 ---
Library/Homebrew/env_config.rb | 4 ----
docs/Manpage.md | 5 -----
3 files changed, 12 deletions(-)
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh
index a6e123a620..951ac5f281 100644
--- a/Library/Homebrew/brew.sh
+++ b/Library/Homebrew/brew.sh
@@ -404,9 +404,6 @@ setup_ssh() {
"${HOMEBREW_BREWED_SSH_PATH}" -V &>/dev/null
then
HOMEBREW_SSH="${HOMEBREW_BREWED_SSH_PATH}"
- elif [[ -n "${HOMEBREW_SSH_PATH}" ]]
- then
- HOMEBREW_SSH="${HOMEBREW_SSH_PATH}"
else
HOMEBREW_SSH="ssh"
fi
diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb
index 567f875f08..9fc076f950 100644
--- a/Library/Homebrew/env_config.rb
+++ b/Library/Homebrew/env_config.rb
@@ -324,10 +324,6 @@ module Homebrew
"`git` repos over `ssh`.",
default_text: "`$HOME/.ssh/config`",
},
- HOMEBREW_SSH_PATH: {
- description: "Set this value to a new enough `ssh` executable for Homebrew to use.",
- default_text: "ssh",
- },
HOMEBREW_SKIP_OR_LATER_BOTTLES: {
description: "If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions " \
"of macOS. This is useful in development on new macOS versions.",
diff --git a/docs/Manpage.md b/docs/Manpage.md
index 22db08fa59..ffe4a55fe1 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -2173,11 +2173,6 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
*Default:* `$HOME/.ssh/config`
-- `HOMEBREW_SSH_PATH`
-
Set this value to a new enough `ssh` executable for Homebrew to use.
-
- *Default:* `ssh`.
-
- `HOMEBREW_SKIP_OR_LATER_BOTTLES`
If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions of macOS. This is useful in development on new macOS versions.
From 1676b39f84435b8db0da159c7ceb37e92b88a2bc Mon Sep 17 00:00:00 2001
From: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com>
Date: Wed, 22 Jun 2022 19:29:59 -0400
Subject: [PATCH 5/5] align manpage with env_config.rb
---
docs/Manpage.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/Manpage.md b/docs/Manpage.md
index ffe4a55fe1..260ed22191 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -2059,7 +2059,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
If set, always use a Homebrew-installed `git`(1) rather than the system version. Automatically set if the system version of `git` is too old.
- `HOMEBREW_FORCE_BREWED_SSH`
-
If set, always use a Homebrew-installed `openssh`(1) rather than the system version.
+
If set, always use a Homebrew-installed `ssh`(1) rather than the system version.
- `HOMEBREW_FORCE_VENDOR_RUBY`
If set, always use Homebrew's vendored, relocatable Ruby version even if the system version of Ruby is new enough.