Update tools.func

This commit is contained in:
CanbiZ 2025-07-03 14:07:18 +02:00
parent 33bd4ac0e9
commit 77323e618e

View File

@ -798,6 +798,7 @@ function fetch_and_deploy_gh_release() {
msg_info "Setup $app ($version)" msg_info "Setup $app ($version)"
### Tarball Mode ###
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
url=$(echo "$json" | jq -r '.tarball_url // empty') url=$(echo "$json" | jq -r '.tarball_url // empty')
[[ -z "$url" ]] && url="https://github.com/$repo/archive/refs/tags/v$version.tar.gz" [[ -z "$url" ]] && url="https://github.com/$repo/archive/refs/tags/v$version.tar.gz"
@ -818,6 +819,7 @@ function fetch_and_deploy_gh_release() {
cp -r "$unpack_dir"/* "$target/" cp -r "$unpack_dir"/* "$target/"
shopt -u dotglob nullglob shopt -u dotglob nullglob
### Binary Mode ###
elif [[ "$mode" == "binary" ]]; then elif [[ "$mode" == "binary" ]]; then
local arch local arch
arch=$(dpkg --print-architecture 2>/dev/null || uname -m) arch=$(dpkg --print-architecture 2>/dev/null || uname -m)
@ -873,6 +875,7 @@ function fetch_and_deploy_gh_release() {
} }
} }
### Prebuild Mode ###
elif [[ "$mode" == "prebuild" ]]; then elif [[ "$mode" == "prebuild" ]]; then
local pattern="$6" local pattern="$6"
[[ -z "$pattern" ]] && { [[ -z "$pattern" ]] && {
@ -883,10 +886,12 @@ function fetch_and_deploy_gh_release() {
local asset_url="" local asset_url=""
for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do
if [[ "$u" == $pattern ]]; then case "$u" in
$pattern)
asset_url="$u" asset_url="$u"
break break
fi ;;
esac
done done
[[ -z "$asset_url" ]] && { [[ -z "$asset_url" ]] && {
@ -916,6 +921,7 @@ function fetch_and_deploy_gh_release() {
return 1 return 1
fi fi
### Singlefile Mode ###
elif [[ "$mode" == "singlefile" ]]; then elif [[ "$mode" == "singlefile" ]]; then
local pattern="$6" local pattern="$6"
[[ -z "$pattern" ]] && { [[ -z "$pattern" ]] && {
@ -926,7 +932,12 @@ function fetch_and_deploy_gh_release() {
local asset_url="" local asset_url=""
for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do
[[ "$u" =~ $pattern || "$u" == *"$pattern" ]] && asset_url="$u" && break case "$u" in
$pattern)
asset_url="$u"
break
;;
esac
done done
[[ -z "$asset_url" ]] && { [[ -z "$asset_url" ]] && {