[更新] 优化镜像使用体验
This commit is contained in:
parent
52c2191f38
commit
40219df6aa
33
安装.zsh
33
安装.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 <- "
|
||||
|
Loading…
x
Reference in New Issue
Block a user