diff --git a/linux-managements/setup.sh b/linux-managements/setup.sh index ba81428..abac89f 100755 --- a/linux-managements/setup.sh +++ b/linux-managements/setup.sh @@ -167,12 +167,25 @@ install_homebrew() { return fi 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 if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" fi + + if ! command -v brew &>/dev/null; then + error "Homebrew installation failed (brew not found after install)" + exit 1 + fi success "Homebrew installed" } @@ -283,15 +296,19 @@ install_docker() { if command -v docker &>/dev/null; then info "Docker already installed ($(docker --version)), skipping" else - info "Downloading Docker install script ..." - curl -fsSL https://config.mitsea.com/install-docker.sh -o /tmp/install-docker.sh - echo "" - echo -e "Use a ${BOLD}mirror${NC} for Docker installation? ${YELLOW}(recommended in China)${NC}" - read -rp "Use nyist mirror? [y/N] " use_mirror + echo -e "Use a ${BOLD}domestic mirror${NC} for Docker installation? ${YELLOW}(recommended in China)${NC}" + read -rp "Use mirror? [y/N] " use_mirror case "$use_mirror" in - [Yy]*) sudo sh /tmp/install-docker.sh --mirror nyist ;; - *) sudo sh /tmp/install-docker.sh ;; + [Yy]*) + 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 success "Docker installed" fi