Skip to content

Commit 58c4a5f

Browse files
committed
Fix download URL retrieval for Linux
The function `fetch_latest_version` was updated to correctly retrieve the architecture specific download URL from a release info response.
1 parent 237897d commit 58c4a5f

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

linux/linux_install.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,29 @@ ARCH=$(uname -m)
99

1010
# Function to fetch the latest release information from Aide Updates API
1111
fetch_latest_version() {
12+
extract_download_url_from_release_info_for() {
13+
for=${1}
14+
printf '%s' "$(
15+
printf '%s' "${release_info}" |
16+
sed "s/^{.*\"${for}\":\"\([[:alnum:]:/.-]\+\)\".*}$/\1/"
17+
)"
18+
}
19+
1220
echo "Fetching the latest Aide release information..."
1321
release_info=$(curl -s https://aide-updates.codestory.ai/api/all/stable)
1422

1523
# Extract URLs based on architecture
1624
case "$ARCH" in
17-
x86_64)
18-
BIN_URL=$(echo "$release_info" | grep '"linux_x64"' | cut -d'"' -f4)
19-
;;
20-
aarch64)
21-
BIN_URL=$(echo "$release_info" | grep '"linux_arm64"' | cut -d'"' -f4)
22-
;;
23-
*)
24-
echo "Unsupported architecture: $ARCH"
25-
exit 1
26-
;;
25+
x86_64)
26+
BIN_URL="$(extract_download_url_from_release_info_for 'linux_x64')"
27+
;;
28+
aarch64)
29+
BIN_URL="$(extract_download_url_from_release_info_for 'linux_arm64')"
30+
;;
31+
*)
32+
printf 'Unsupported architecture: %s\n' "${ARCH}"
33+
exit 1
34+
;;
2735
esac
2836

2937
if [[ -z "$BIN_URL" ]]; then

0 commit comments

Comments
 (0)