Skip to content

Commit 254f2b8

Browse files
authored
tools.func: optimize binary build installs with helper (#5588)
1 parent 733251a commit 254f2b8

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

misc/tools.func

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -834,19 +834,30 @@ function fetch_and_deploy_gh_release() {
834834
elif [[ "$mode" == "binary" ]]; then
835835
local arch
836836
arch=$(dpkg --print-architecture 2>/dev/null || uname -m)
837-
[[ "$arch" == "x86_64" ]] && arch="x86_64"
837+
[[ "$arch" == "x86_64" ]] && arch="amd64"
838838
[[ "$arch" == "aarch64" ]] && arch="arm64"
839839

840840
local assets url_match=""
841841
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
842842

843-
for u in $assets; do
844-
if [[ "$u" =~ ($arch|amd64|x86_64|aarch64|arm64).*\.deb$ ]]; then
845-
url_match="$u"
846-
break
847-
fi
848-
done
843+
# If explicit filename pattern is provided (param $6), match that first
844+
if [[ -n "$6" ]]; then
845+
for u in $assets; do
846+
[[ "$u" =~ $6 || "$u" == *"$6" ]] && url_match="$u" && break
847+
done
848+
fi
849+
850+
# If no match via explicit pattern, fall back to architecture heuristic
851+
if [[ -z "$url_match" ]]; then
852+
for u in $assets; do
853+
if [[ "$u" =~ ($arch|amd64|x86_64|aarch64|arm64).*\.deb$ ]]; then
854+
url_match="$u"
855+
break
856+
fi
857+
done
858+
fi
849859

860+
# Fallback: any .deb file
850861
if [[ -z "$url_match" ]]; then
851862
for u in $assets; do
852863
[[ "$u" =~ \.deb$ ]] && url_match="$u" && break

0 commit comments

Comments
 (0)