fix: add Debian codename matching for binary mode in fetch_and_deploy_gh_release

This commit is contained in:
CanbiZ (MickLesk) 2026-02-10 14:42:13 +01:00
parent 82de09f19f
commit 754b3d4b6b

View File

@ -1974,6 +1974,12 @@ function fetch_and_deploy_gh_release() {
[[ "$arch" == "x86_64" ]] && arch="amd64"
[[ "$arch" == "aarch64" ]] && arch="arm64"
# Get Debian codename for distro-specific packages
local codename=""
if [[ -f /etc/os-release ]]; then
codename=$(grep -oP '(?<=VERSION_CODENAME=).*' /etc/os-release 2>/dev/null || true)
fi
local assets url_match=""
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
@ -1989,7 +1995,17 @@ function fetch_and_deploy_gh_release() {
done
fi
# If no match via explicit pattern, fall back to architecture heuristic
# If no match via explicit pattern, try architecture + codename match
if [[ -z "$url_match" && -n "$codename" ]]; then
for u in $assets; do
if [[ "$u" =~ $arch.*$codename.*\.deb$ ]] || [[ "$u" =~ $arch.*-$codename\.deb$ ]] || [[ "$u" =~ ${arch}-${codename}\.deb$ ]] || [[ "$u" =~ ${arch}_${codename}\.deb$ ]]; then
url_match="$u"
break
fi
done
fi
# Fallback: architecture heuristic without codename
if [[ -z "$url_match" ]]; then
for u in $assets; do
if [[ "$u" =~ ($arch|amd64|x86_64|aarch64|arm64).*\.deb$ ]]; then