Update tools.func

This commit is contained in:
CanbiZ 2025-07-24 13:31:39 +02:00
parent a188076457
commit 4707eac364

View File

@ -882,16 +882,12 @@ function fetch_and_deploy_gh_release() {
shopt -u dotglob nullglob shopt -u dotglob nullglob
### Binary Mode ### ### Binary Mode ###
### Binary Mode (with DEBUG) ###
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)
[[ "$arch" == "x86_64" ]] && arch="amd64" [[ "$arch" == "x86_64" ]] && arch="amd64"
[[ "$arch" == "aarch64" ]] && arch="arm64" [[ "$arch" == "aarch64" ]] && arch="arm64"
echo "[DEBUG] Detected system architecture: $arch"
echo "[DEBUG] Provided asset_pattern: ${asset_pattern:-<none>}"
local assets url_match="" local assets url_match=""
assets=$(echo "$json" | jq -r '.assets[].browser_download_url') assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
@ -902,12 +898,9 @@ function fetch_and_deploy_gh_release() {
# 1. Pattern match # 1. Pattern match
if [[ -n "$asset_pattern" ]]; then if [[ -n "$asset_pattern" ]]; then
echo "[DEBUG] Trying to match provided pattern: $asset_pattern"
for u in $assets; do for u in $assets; do
filename_candidate="${u##*/}" filename_candidate="${u##*/}"
echo " [DEBUG] Checking asset: $filename_candidate"
if [[ "$filename_candidate" == *"$asset_pattern"* ]]; then if [[ "$filename_candidate" == *"$asset_pattern"* ]]; then
echo " [DEBUG] ✅ Pattern matched: $filename_candidate"
url_match="$u" url_match="$u"
break break
fi fi
@ -916,12 +909,10 @@ function fetch_and_deploy_gh_release() {
# 2. Arch match (only if no pattern match) # 2. Arch match (only if no pattern match)
if [[ -z "$url_match" ]]; then if [[ -z "$url_match" ]]; then
echo "[DEBUG] No pattern match, trying architecture match: $arch"
for u in $assets; do for u in $assets; do
filename_candidate="${u##*/}" filename_candidate="${u##*/}"
echo " [DEBUG] Checking asset: $filename_candidate" echo " [DEBUG] Checking asset: $filename_candidate"
if [[ "$filename_candidate" == *"$arch"* && "$filename_candidate" == *.deb ]]; then if [[ "$filename_candidate" == *"$arch"* && "$filename_candidate" == *.deb ]]; then
echo " [DEBUG] ✅ Architecture match: $filename_candidate"
url_match="$u" url_match="$u"
break break
fi fi
@ -930,12 +921,9 @@ function fetch_and_deploy_gh_release() {
# 3. Fallback # 3. Fallback
if [[ -z "$url_match" ]]; then if [[ -z "$url_match" ]]; then
echo "[DEBUG] No architecture match, falling back to first .deb"
for u in $assets; do for u in $assets; do
filename_candidate="${u##*/}" filename_candidate="${u##*/}"
echo " [DEBUG] Checking asset: $filename_candidate"
if [[ "$filename_candidate" == *.deb ]]; then if [[ "$filename_candidate" == *.deb ]]; then
echo " [DEBUG] ✅ Fallback match: $filename_candidate"
url_match="$u" url_match="$u"
break break
fi fi