🐛 fix(setup): detect Homebrew download failure and verify installation
Split curl download from bash execution so network errors are caught explicitly. Add post-install verification that brew is actually available before reporting success. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -167,12 +167,25 @@ install_homebrew() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
info "Installing Homebrew ..."
|
info "Installing Homebrew ..."
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
local install_script
|
||||||
|
install_script="$(mktemp)"
|
||||||
|
if ! curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o "$install_script"; then
|
||||||
|
rm -f "$install_script"
|
||||||
|
error "Failed to download Homebrew install script (network error)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
/bin/bash "$install_script"
|
||||||
|
rm -f "$install_script"
|
||||||
|
|
||||||
# Add brew to PATH for the rest of this script
|
# Add brew to PATH for the rest of this script
|
||||||
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
|
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
|
||||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! command -v brew &>/dev/null; then
|
||||||
|
error "Homebrew installation failed (brew not found after install)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
success "Homebrew installed"
|
success "Homebrew installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,15 +296,19 @@ install_docker() {
|
|||||||
if command -v docker &>/dev/null; then
|
if command -v docker &>/dev/null; then
|
||||||
info "Docker already installed ($(docker --version)), skipping"
|
info "Docker already installed ($(docker --version)), skipping"
|
||||||
else
|
else
|
||||||
info "Downloading Docker install script ..."
|
|
||||||
curl -fsSL https://config.mitsea.com/install-docker.sh -o /tmp/install-docker.sh
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "Use a ${BOLD}mirror${NC} for Docker installation? ${YELLOW}(recommended in China)${NC}"
|
echo -e "Use a ${BOLD}domestic mirror${NC} for Docker installation? ${YELLOW}(recommended in China)${NC}"
|
||||||
read -rp "Use nyist mirror? [y/N] " use_mirror
|
read -rp "Use mirror? [y/N] " use_mirror
|
||||||
case "$use_mirror" in
|
case "$use_mirror" in
|
||||||
[Yy]*) sudo sh /tmp/install-docker.sh --mirror nyist ;;
|
[Yy]*)
|
||||||
*) sudo sh /tmp/install-docker.sh ;;
|
curl -fsSL https://git.mitsea.com/FlintyLemming/scripts-public/raw/branch/main/linux-managements/install-docker.sh \
|
||||||
|
-o /tmp/install-docker.sh
|
||||||
|
sudo sh /tmp/install-docker.sh --mirror nyist
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
curl -fsSL https://get.docker.com -o /tmp/get-docker.sh
|
||||||
|
sudo sh /tmp/get-docker.sh
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
success "Docker installed"
|
success "Docker installed"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user