fix: a fresh Mac installs Homebrew before the brew stage
core/brew was `-builtin` on Darwin, and builtin runs after install_brew, so a Mac without Homebrew failed every brew row "brew missing" and needed a second run. It is a script row on both platforms now. The apt prerequisite line is guarded to apt platforms, and on macOS `sudo -v` caches the timestamp that NONINTERACTIVE=1 Homebrew requires. Darwin dispatch-order test via the fake uname, plus a mutation (G-boot-1).
This commit is contained in:
1 parent
6fa7603633
commit
91a1224a5e
4 files changed
+51
-6
No files matched your search
@@ -0,0 +1,11 @@
|
||||
# what: core/brew runs its apt prerequisites on every platform again
|
||||
# why: a Mac has no apt; the line warns, and the sudo it needs is never asked for
|
||||
# kills: darwin: no apt prerequisites on a machine with no apt
|
||||
# run: unit
|
||||
<<<OLD
|
||||
if [ "$PLAT" = apt ]; then
|
||||
# The installer's own documented prerequisites. git is already
|
||||
<<<NEW
|
||||
if true; then
|
||||
# The installer's own documented prerequisites. git is already
|
||||
<<<END
|
||||
@@ -492,6 +492,10 @@ is "darwin: claude desktop is the cask" "brew claude" "$(drs apps/cl
|
||||
is "darwin: signal is the cask" "brew signal" "$(drs apps/signal)"
|
||||
is "darwin: bun is the tap" "brew oven-sh/bun/bun" "$(drs core/bun)"
|
||||
is "darwin: incus has no source" "unavailable" "$(drs virt/incus | tr -d ' ')"
|
||||
# G-boot-1: core/brew was `builtin` here, and builtin runs AFTER the brew stage,
|
||||
# so a fresh Mac failed every brew row "brew missing" and only then installed
|
||||
# Homebrew. A script row runs before brew, on both platforms.
|
||||
is "darwin: homebrew itself is a script row" "script brew" "$(drs core/brew)"
|
||||
|
||||
# Nothing in the default set may be unresolvable — that is a manifest bug, and
|
||||
# it is silent until someone runs the installer on a fresh machine.
|
||||
@@ -762,6 +766,24 @@ else
|
||||
printf ' \033[33mskip\033[0m go sits at an absolute path find_tool probes\n'
|
||||
fi
|
||||
|
||||
printf '\n\033[1ma fresh Mac installs Homebrew before the brew stage\033[0m\n'
|
||||
# The seal's own uname swapped for the fake Mac one: the whole of the run, not
|
||||
# just resolution, believes it is on Darwin. A dry run, because what matters is
|
||||
# the ORDER of the commands, and --print shows exactly what a real run executes.
|
||||
newbox; sh ./seal.sh "$SB/seal" --with sudo >/dev/null
|
||||
ln -sf "$DARWIN/uname" "$SB/seal/uname"; BOXPATH=$SB/seal
|
||||
pick core/brew agents/herdr
|
||||
dry=$(box --print install 2>&1 | plain || true)
|
||||
is "darwin: the Homebrew installer runs before any brew install" "yes" \
|
||||
"$(a=$(printf '%s\n' "$dry" | grep -n 'Homebrew/install/HEAD/install.sh' | head -1 | cut -d: -f1)
|
||||
b=$(printf '%s\n' "$dry" | grep -n 'brew install herdr' | head -1 | cut -d: -f1)
|
||||
[ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] && echo yes || echo "no [$a/$b]")"
|
||||
is "darwin: …after asking for sudo, which NONINTERACTIVE cannot" "yes" \
|
||||
"$(a=$(printf '%s\n' "$dry" | grep -n '+ sudo -v$' | head -1 | cut -d: -f1)
|
||||
b=$(printf '%s\n' "$dry" | grep -n 'Homebrew/install/HEAD/install.sh' | head -1 | cut -d: -f1)
|
||||
[ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] && echo yes || echo "no [$a/$b]")"
|
||||
hasnt "darwin: no apt prerequisites on a machine with no apt" "apt-get" "$dry"
|
||||
|
||||
printf '\n\033[1mclaude desktop trusts only Anthropic'"'"'s key\033[0m\n'
|
||||
# A vendor apt repository is a key apt will trust for root-installed packages,
|
||||
# so the key is checked against the published fingerprint before it is placed.
|
||||
|
||||
@@ -967,11 +967,23 @@ install_bespoke() {
|
||||
note_fail "$key" "Homebrew refuses to install as root — run dotup as your own user"
|
||||
continue
|
||||
fi
|
||||
# The installer's own documented prerequisites. git is already here,
|
||||
# since the public tier cannot apply without it; the rest are not.
|
||||
apt_update_once
|
||||
run_sh "${SUDO:+$SUDO }DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential procps curl file git" \
|
||||
|| warn "could not install Homebrew's build prerequisites"
|
||||
if [ "$PLAT" = apt ]; then
|
||||
# The installer's own documented prerequisites. git is already
|
||||
# here, since the public tier cannot apply without it; the rest
|
||||
# are not. A Mac has no apt: its prerequisite is the CLT, which
|
||||
# the git check before apply already insisted on.
|
||||
apt_update_once
|
||||
run_sh "${SUDO:+$SUDO }DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential procps curl file git" \
|
||||
|| warn "could not install Homebrew's build prerequisites"
|
||||
else
|
||||
# On macOS, NONINTERACTIVE=1 makes Homebrew's installer demand
|
||||
# sudo WITHOUT a prompt: with no cached timestamp it aborts, and
|
||||
# every brew row after it fails "brew missing". Ask for the
|
||||
# password here, where a person can still type it. With nobody
|
||||
# at the keyboard `sudo -v` fails and this says why.
|
||||
run_sh "sudo -v" \
|
||||
|| { note_fail "$key" "Homebrew on macOS needs an administrator password (sudo -v failed)"; continue; }
|
||||
fi
|
||||
run_sh "NONINTERACTIVE=1 /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"" \
|
||||
|| { note_fail "$key" "the Homebrew installer failed"; continue; }
|
||||
# install_brew resolves through find_tool, which probes the linuxbrew
|
||||
|
||||
@@ -75,7 +75,7 @@ core gh safe gh gh
|
||||
core chezmoi safe -script chezmoi bootstrap cannot come from the manifest
|
||||
core go safe -tarball go /usr/local/go on linux
|
||||
core uv safe -script uv astral installer to ~/.local/bin
|
||||
core brew safe -script -builtin linuxbrew — the only source for lazygit, omp and herdr
|
||||
core brew safe -script -script linuxbrew — the only source for lazygit, omp and herdr
|
||||
core node safe -tarball node apt ships 18.19 and the npm rows below need 20+ — tarball to /opt/node
|
||||
core imagemagick safe imagemagick imagemagick required by the nvim markdown render path
|
||||
core mermaid-cli safe -npm -npm mmdc — nvim renders mermaid fences with it
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 17 and column 49.
|
Reference in new issue
Block a user