From 4a73a8c348c089a843ba7e246d6d00e6c26dcdcd Mon Sep 17 00:00:00 2001 From: WanWanYun Date: Thu, 13 Nov 2025 01:41:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DGitee=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E5=8A=A0=E9=80=9F=E4=BB=8D=E4=BB=8EGitHub=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题描述: - 虽然显示"使用Gitee镜像加速" - 但acme.sh安装脚本内部仍从GitHub下载tar.gz包 - 导致国内网络安装失败 根本原因: - 使用了 --install-online 参数 - acme.sh脚本会在线下载master.tar.gz - 默认还是从GitHub下载 修复方案: - 使用acme.sh官方推荐的方法 - 设置环境变量 ACME_USE_GITEE=1 - 让acme.sh内部也使用Gitee源 - 移除 --install-online 参数 官方文档: https://github.com/acmesh-official/acme.sh/wiki/Install-in-China 修复代码: # 国内网络 export ACME_USE_GITEE=1 curl https://gitee.com/neilpang/acme.sh/raw/master/acme.sh | sh 修复函数: - deploy_acme_letsencrypt - deploy_acme_zerossl - deploy_acme_buypass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- install.sh | 97 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 38 deletions(-) diff --git a/install.sh b/install.sh index 80c219d..604e600 100644 --- a/install.sh +++ b/install.sh @@ -1244,27 +1244,34 @@ deploy_acme_letsencrypt() { # 检测是否在中国大陆,使用镜像加速 if curl -s --connect-timeout 3 https://www.google.com > /dev/null 2>&1; then - # 海外网络 - ACME_INSTALL_URL="https://get.acme.sh" + # 海外网络 - 使用官方源 + if curl -fsSL https://get.acme.sh | sh; then + source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true + print_success "acme.sh 安装成功" + else + print_error "acme.sh 安装失败" + return 1 + fi else - # 中国大陆,使用Gitee镜像 + # 中国大陆 - 使用Gitee镜像(官方方法) print_info "检测到国内网络,使用Gitee镜像加速..." - ACME_INSTALL_URL="https://gitee.com/neilpang/acme.sh/raw/master/acme.sh" - fi - if curl -fsSL "$ACME_INSTALL_URL" | sh -s -- --install-online; then - # 重新加载环境变量 - source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true - print_success "acme.sh 安装成功" - else - print_error "acme.sh 安装失败" - echo "" - print_warning "解决方案:" - echo " 1. 检查网络连接" - echo " 2. 尝试手动安装: curl https://get.acme.sh | sh" - echo " 3. 或访问: https://github.com/acmesh-official/acme.sh/wiki/Install-in-China" - echo "" - return 1 + # 设置环境变量,让acme.sh使用Gitee源 + export ACME_USE_GITEE=1 + + if curl -fsSL https://gitee.com/neilpang/acme.sh/raw/master/acme.sh | sh; then + source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true + print_success "acme.sh 安装成功" + else + print_error "acme.sh 安装失败" + echo "" + print_warning "解决方案:" + echo " 1. 检查网络连接" + echo " 2. 尝试手动安装: export ACME_USE_GITEE=1 && curl https://gitee.com/neilpang/acme.sh/raw/master/acme.sh | sh" + echo " 3. 或访问: https://github.com/acmesh-official/acme.sh/wiki/Install-in-China" + echo "" + return 1 + fi fi fi @@ -1316,18 +1323,25 @@ deploy_acme_zerossl() { # 检测网络环境 if curl -s --connect-timeout 3 https://www.google.com > /dev/null 2>&1; then - ACME_INSTALL_URL="https://get.acme.sh" + # 海外网络 + if curl -fsSL https://get.acme.sh | sh; then + source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true + print_success "acme.sh 安装成功" + else + print_error "acme.sh 安装失败" + return 1 + fi else + # 中国大陆 - 使用Gitee镜像 print_info "检测到国内网络,使用Gitee镜像加速..." - ACME_INSTALL_URL="https://gitee.com/neilpang/acme.sh/raw/master/acme.sh" - fi - - if curl -fsSL "$ACME_INSTALL_URL" | sh -s -- --install-online; then - source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true - print_success "acme.sh 安装成功" - else - print_error "acme.sh 安装失败" - return 1 + export ACME_USE_GITEE=1 + if curl -fsSL https://gitee.com/neilpang/acme.sh/raw/master/acme.sh | sh; then + source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true + print_success "acme.sh 安装成功" + else + print_error "acme.sh 安装失败" + return 1 + fi fi fi @@ -1373,18 +1387,25 @@ deploy_acme_buypass() { # 检测网络环境 if curl -s --connect-timeout 3 https://www.google.com > /dev/null 2>&1; then - ACME_INSTALL_URL="https://get.acme.sh" + # 海外网络 + if curl -fsSL https://get.acme.sh | sh; then + source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true + print_success "acme.sh 安装成功" + else + print_error "acme.sh 安装失败" + return 1 + fi else + # 中国大陆 - 使用Gitee镜像 print_info "检测到国内网络,使用Gitee镜像加速..." - ACME_INSTALL_URL="https://gitee.com/neilpang/acme.sh/raw/master/acme.sh" - fi - - if curl -fsSL "$ACME_INSTALL_URL" | sh -s -- --install-online; then - source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true - print_success "acme.sh 安装成功" - else - print_error "acme.sh 安装失败" - return 1 + export ACME_USE_GITEE=1 + if curl -fsSL https://gitee.com/neilpang/acme.sh/raw/master/acme.sh | sh; then + source ~/.bashrc 2>/dev/null || source ~/.profile 2>/dev/null || true + print_success "acme.sh 安装成功" + else + print_error "acme.sh 安装失败" + return 1 + fi fi fi