Skip to content

Commit c16cff0

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 c16cff0

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

linux/linux_install.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,30 @@ 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+
grep "${for}" |
17+
sed "s/^.*\"${for}\":\"\([[:alnum:]:/.-]\+\)\".*$/\1/"
18+
)"
19+
}
20+
1221
echo "Fetching the latest Aide release information..."
1322
release_info=$(curl -s https://aide-updates.codestory.ai/api/all/stable)
1423

1524
# Extract URLs based on architecture
1625
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-
;;
26+
x86_64)
27+
BIN_URL="$(extract_download_url_from_release_info_for 'linux_x64')"
28+
;;
29+
aarch64)
30+
BIN_URL="$(extract_download_url_from_release_info_for 'linux_arm64')"
31+
;;
32+
*)
33+
printf 'Unsupported architecture: %s\n' "${ARCH}"
34+
exit 1
35+
;;
2736
esac
2837

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

0 commit comments

Comments
 (0)