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,29 @@ 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+ 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
You can’t perform that action at this time.
0 commit comments