File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,21 +9,30 @@ ARCH=$(uname -m)
99
1010# Function to fetch the latest release information from Aide Updates API
1111fetch_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
You can’t perform that action at this time.
0 commit comments