Adapt homebrew installation for macOS on Intel

This commit is contained in:
T. R. Bernstein
2025-10-16 23:21:29 +02:00
parent 60fc6580d8
commit 5c1a6998b7

View File

@@ -96,8 +96,12 @@ function getHomebrewRepositoryPath() {
function createBrewCallerScript() {
ensureLocalBinFolder
local uname_machine=$(/usr/bin/uname -m)
local username=${homebrew_username}
local brewCallerPath="/usr/local/bin/brew"
local homebrewRepositoryPath="$(getHomebrewRepositoryPath)"
local brewCallerPath="${homebrewRepositoryPath}/bin/brew-caller"
local brewCallerSymlink="/usr/local/bin/brew"
[[ ${uname_machine} == "arm64" ]] && brewCallerPath="${brewCallerSymlink}"
[ -f "${brewCallerPath}" ] && rm "${brewCallerPath}"
cat <<- BREWCALLER > ${brewCallerPath}
#!/usr/bin/env zsh
@@ -114,10 +118,11 @@ function createBrewCallerScript() {
export HOMEBREW_NO_ANALYTICS_THIS_RUN=1
export HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT=1
umask 002
"$(getHomebrewRepositoryPath)/bin/brew" "\$@"
"${homebrewRepositoryPath}/bin/brew" "\$@"
BREWCALLER
chown root:admin ${brewCallerPath}
chmod ug+x,o-x ${brewCallerPath}
[[ ${uname_machine} == "arm64" ]] || ln -s "${brewCallerPath}" "${brewCallerSymlink}"
}
function createBrewPeriodicScript() {