在新开的woiden上执行用ghproxy处理的xray安装脚本 安装prerelease版本 成了1.4.0版本

新开了一个woiden小鸡, 直接执行github脚本, 会获取不成功github资源.

执行用ghproxy处理的xray reality极简一键脚本

bash <(curl -L https://ghproxy.crazypeace.workers.dev/https://github.com/crazypeace/xray-vless-reality/raw/main/install.sh | perl -pe "$(curl -L https://ghproxy.crazypeace.workers.dev/perl-pe-para)") auto 8443

报错说 xray x25519 未知命令.


bash 带上 -x 参数, 查了一下安装过程, 发现xray安装的是1.4.0版本.


细查xray的安装脚本.

安装之前的脚本是

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install --beta

用ghproxy转换后是

bash -c "$(curl -L https://ghproxy.crazypeace.workers.dev/https://github.com/XTLS/Xray-install/raw/main/install-release.sh | perl -pe "$(curl -L https://ghproxy.crazypeace.workers.dev/perl-pe-para)")" @ install --beta

查了一下转换之后的脚本内容

curl -L https://ghproxy.crazypeace.workers.dev/https://github.com/XTLS/Xray-install/raw/main/install-release.sh | perl -pe "$(curl -L https://ghproxy.crazypeace.workers.dev/perl-pe-para)" > tmp.sh

再和转换之前的脚本内容比较, 发现处理github资源的链接是正确的, 如:


但是下面这里处理错了. 

处理前,

if ! curl -x "${PROXY}" -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then

处理后

if ! curl -x "${PROXY}" -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sh | perl -pe "$(curl -L https://ghproxy.crazypeace.workers.dev/perl-pe-para)" a256sum" "${1}.sha256sum"; then

对应的 https://ghproxy.crazypeace.workers.dev/perl-pe-para 的内容:

s#(curl.*?\.sh)([^/])#\1 | perl -pe "\$(curl -L https://ghproxy.crazypeace.workers.dev/perl-pe-para)" \2#g; s# (git)# https://\1#g; s#(http.*?git[^/]*?/)#https://ghproxy.crazypeace.workers.dev/\1#g

前面部分的匹配部分不够严谨.

修改为: 

s#(curl.*?\.sh)([^/\d\w])#\1 | perl -pe "\$(curl -L https://ghproxy.crazypeace.workers.dev/perl-pe-para)" \2#g; s# (git)# https://\1#g; s#(http.*?git[^/]*?/)#https://ghproxy.crazypeace.workers.dev/\1#g


再检验一下结果, 发现还是安装的1.4.0版本.

再查, 如果不是 --beta 参数的话, 是正常的. 但加上 --beta 参数后, 就安装成了1.4.0版本.

走读 https://github.com/XTLS/Xray-install/blob/main/install-release.sh 脚本. 原来逻辑是这样的:

(1) 先从 https://api.github.com/repos/XTLS/Xray-core/releases 得到全部的版本号, 

(2) 然后用版本号和操作系统拼装下载链接,

(3) 再用下载链接去releases查找有没有, 

  如果找不到, 那就换下一个版本号尝试.

我想了一下, 这个逻辑应该是为了解决这样的情况, 如果预发布的版本prerelease version里面没有编译发布全部的操作系统的压缩包.

在脚本被 ghproxy 页面处理过后, 第(2)步的下载链接是github资源, 会在前面加上 ghproxy, 而releases里面的链接自然是没有加上ghproxy的, 所以就会一直查找不到. 最后版本号遍历到了最旧的1.4.0.

用bash -x跑出来的局部记录如下:

+ for i in ${!releases_list[@]}
+ releases_list[$i]=v1.8.3
+ grep -q https://ghproxy.crazypeace.workers.dev/https://github.com/XTLS/Xray-core/releases/download/v1.8.3/Xray-linux-64.zip /tmp/tmp.YMjNLZwtAE


解决方案, 不使用 --beta 参数, 改为使用 --version参数.

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install --version 1.8.3

已提交 Github 

https://github.com/crazypeace/xray-vless-reality 

评论

The Hot3 in Last 30 Days

无服务器 自建短链服务 Url-Shorten-Worker 完整的部署教程

ClouDNS .asia免费域名 托管到CloudFlare开CDN白嫖Websocket WS通道翻墙 / desec.io