-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
主要兼容性建议 #782
base: develop
Are you sure you want to change the base?
主要兼容性建议 #782
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,18 @@ set -u | |
set -o pipefail | ||
|
||
verbose=false # 开启debug日志 | ||
bili_repo="raywangqvq/bilibilitoolpro" # 仓库地址 | ||
#bili_repo="raywangqvq/bilibilitoolpro" # 仓库地址 输入官方分支,或者加速分支目录 | ||
# 针对使用fock拉取分支的情况,建议把bili_repo做在环境变量中可以修改调整 | ||
# 可更兼容性 | ||
#bili_repo="aspnmy/BiliBiliToolPro" | ||
bili_repo=${BILI_TRUETRUE_REPONAME:-"raywangqvq/bilibilitoolpro"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 是否可以 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 你自己的项目 你可以自己想一想,如果我取的话,缩减一下可以用 BILI_TRUEUSE_NAME (实际使用路径) |
||
bili_branch="" # 分支名,空或_develop | ||
prefer_mode=${BILI_MODE:-"dotnet"} # dotnet或bilitool,需要通过环境变量配置 | ||
prefer_mode=${BILI_MODE:-""} # dotnet或bilitool,需要通过环境变量配置 | ||
github_proxy=${BILI_GITHUB_PROXY:-""} # 下载github release包时使用的代理,会拼在地址前面,需要通过环境变量配置 | ||
|
||
|
||
|
||
|
||
# Use in the the functions: eval $invocation | ||
invocation='say_verbose "Calling: ${yellow:-}${FUNCNAME[0]} ${green:-}$*${normal:-}"' | ||
|
||
|
@@ -83,7 +90,10 @@ touch /root/.bashrc && . /root/.bashrc | |
# 目录 | ||
say "青龙repo目录: $dir_repo" | ||
qinglong_bili_repo="$(echo "$bili_repo" | sed 's/\//_/g')${bili_branch}" | ||
|
||
qinglong_bili_repo_dir="$(find $dir_repo -type d \( -iname $qinglong_bili_repo -o -iname ${qinglong_bili_repo}_main \) | head -1)" | ||
#qinglong_bili_repo_dir="$qinglong_bili_repo/podAdmin_BiliBiliToolPro" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 调试代码不建议提交 |
||
|
||
say "bili仓库目录: $qinglong_bili_repo_dir" | ||
|
||
current_linux_os="debian" # 或alpine | ||
|
@@ -92,6 +102,8 @@ machine_architecture="x64" # 或arm、arm64 | |
|
||
bilitool_installed_version=0 | ||
|
||
|
||
|
||
# 以下操作仅在bilitool仓库的根bin文件下执行 | ||
cd $qinglong_bili_repo_dir | ||
mkdir -p bin && cd $qinglong_bili_repo_dir/bin | ||
|
@@ -257,6 +269,9 @@ check_unzip() { | |
fi | ||
} | ||
|
||
|
||
|
||
|
||
# 检查dotnet | ||
check_dotnet() { | ||
eval $invocation | ||
|
@@ -279,14 +294,15 @@ check_bilitool() { | |
TAG_FILE="./tag.txt" | ||
touch $TAG_FILE | ||
local STORED_TAG=$(cat $TAG_FILE 2>/dev/null) | ||
|
||
echo $STORED_TAG | ||
#如果STORED_TAG为空,则返回1 | ||
if [[ -z $STORED_TAG ]]; then | ||
say "tag.txt为空,未安装过" | ||
return 1 | ||
fi | ||
|
||
say "tag.txt记录的版本:$STORED_TAG" | ||
|
||
|
||
|
||
# 查找当前目录下是否有叫Ray.BiliBiliTool.Console的文件 | ||
if [ -f "./Ray.BiliBiliTool.Console" ]; then | ||
|
@@ -379,8 +395,26 @@ install_dotnet() { | |
# 从github获取bilitool下载地址 | ||
get_download_url() { | ||
eval $invocation | ||
|
||
tag=$1 | ||
# 增加业务逻辑:主要为了解决完成抓不到版本号时造成的更新错误 | ||
# 可配置环境变量,自定义一个初始值,然后进行下载,避免因为返回值为null而下载不了安装包 | ||
# bilitool: tag.txt记录的版本:null | ||
# bilitool: bilitool未安装 | ||
# bilitool: 开始安装环境 | ||
# bilitool: 开始安装bilitool | ||
# bilitool: 最新版本:null | ||
# bilitool: 下载地址:https://ghproxy.net/https://github.com/RayWangQvQ/BiliBiliToolPro/releases/download/null/bilibili-tool-pro-vnull-linux-musl-x64.zip | ||
# % Total % Received % Xferd Average Speed Time Time Time Current | ||
# Dload Upload Total Spent Left Speed | ||
# 100 9 100 9 0 0 10 0 --:--:-- --:--:-- --:--:-- 10 | ||
# Archive: bilitool-null.zip | ||
# End-of-central-directory signature not found. Either this file is not | ||
# a zipfile, or it constitutes one disk of a multi-part archive. In the | ||
# latter case the central directory and zipfile comment will be found on | ||
# the last disk(s) of this archive. | ||
# unzip: cannot find zipfile directory in one of bilitool-null.zip or | ||
# bilitool-null.zip.zip, and cannot find bilitool-null.zip.ZIP, period. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 调试代码不建议提交 |
||
|
||
tag=${BILI_STORED_TAG:-""} | ||
url="${github_proxy}https://github.com/RayWangQvQ/BiliBiliToolPro/releases/download/$tag/bilibili-tool-pro-v$tag-$current_os-$machine_architecture.zip" | ||
say "下载地址:$url" | ||
echo $url | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
@@ -398,7 +432,7 @@ install_bilitool() { | |
# 解析最新的tag名称 | ||
check_jq | ||
LATEST_TAG=$(echo $LATEST_RELEASE | jq -r '.tag_name') | ||
say "最新版本:$LATEST_TAG" | ||
say "最新版本:$LATEST_TAG , 如果显示为null,就读取环境变量中BILI_STORED_TAG参数手工设置的版本号,避免下载文件遇到 no found错误" | ||
|
||
# 读取之前存储的tag并比较 | ||
if [ "$LATEST_TAG" != "$bilitool_installed_version" ]; then | ||
|
@@ -472,3 +506,4 @@ run_task() { | |
|
||
check_os | ||
install | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调试代码不建议提交