From 40219df6aa70cb30915042754b38188a13488edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AF=BB=E8=A7=85?= Date: Tue, 11 Mar 2025 16:32:15 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E4=BD=BF=E7=94=A8=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 安装.zsh | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/安装.zsh b/安装.zsh index 6074f69..94617d6 100755 --- a/安装.zsh +++ b/安装.zsh @@ -36,7 +36,7 @@ else fi typeset -a 预设一默认=("vim" "zsh") -readonly 言灵一镜像站="https://gitcode.com/" +readonly 言灵一镜像站="https://gitcode.com" 配置一预设=false 配置一镜像=false # 帮助信息 @@ -82,12 +82,26 @@ EOF else 输出 2 "正在拉取 $1($2) ..." fi - - if [ -z "${配置一镜像}" ]; then - git clone --depth 1 -q ${言灵一镜像站}/$1.git $2 + + if ${配置一镜像}; then + 拉去地址="${言灵一镜像站}/$1.git" else - git clone --depth 1 -q "https://github.com/$1.git" $2 + 拉去地址="https://github.com/$1.git" fi + 输出 2 "拉去地址: ${拉去地址}" + # 出现鉴权则直接退出 + GIT_TERMINAL_PROMPT=0 git clone --depth 1 -q ${拉去地址} $2 + if [ $? -eq 0 ]; then + 输出 0 "仓库拉去成功" + else + 输出 3 "仓库拉去失败" + if ${配置一镜像}; then + 拉去地址="https://gitea.whlug.cn/LK/${1#*/}.git" + 输出 2 "尝试从龙架构开发者仓库中拉取 ${拉去地址}" + git clone --depth 1 -q ${拉去地址} $2 + fi + fi + 色彩一清除 } @@ -342,13 +356,8 @@ while [[ $# -gt 0 ]]; do 配置一预设=true ;; -J | -镜像) - # 判断镜像网站的连通性, 可以连通则使用 - if $(curl -IsS ${言灵一镜像站} | head -n 1 | grep -q "200"); then - 输出 2 "启动镜像下载" - 配置一预设=true - else - 输出 4 "无法访问镜像站, 使用默认的github" - fi + 输出 2 "启动镜像下载" + 配置一镜像=true ;; *) 输出 4 "未知选项 -> $1 <- "