33# supported CPU architectures and operating systems
44SUPPORTED_ARCH=(" x86_64" " arm64" )
55SUPPORTED_OS=(" linux" " darwin" )
6- # Associate binaries with CPU architectures and operating systems
7- declare -A BINARIES=(
8- [" x86_64-linux" ]=" Parseable_x86_64-unknown-linux-gnu"
9- [" arm64-linux" ]=" Parseable_aarch64-unknown-linux-gnu"
10- [" x86_64-darwin" ]=" Parseable_x86_64-apple-darwin"
11- [" arm64-darwin" ]=" Parseable_aarch64-apple-darwin"
12- )
6+ DOWNLOAD_BASE_URL=" parseable.gateway.scarf.sh/"
7+
138# Get the system's CPU architecture and operating system
149CPU_ARCH=$( uname -m)
1510OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
1611
12+ printf " \n=========================\n"
1713printf " Detected CPU architecture: %s\n" " $CPU_ARCH "
1814printf " Detected operating system: %s\n" " $OS "
1915
@@ -34,38 +30,29 @@ if ! echo "${SUPPORTED_OS[@]}" | grep -q "\\b${OS}\\b"; then
3430 echo " Error: Unsupported operating system (${OS} )."
3531 exit 1
3632fi
33+
3734# Get the latest release information using GitHub API
3835release=$( curl -s " https://api.github.com/repos/parseablehq/parseable/releases/latest" )
36+ # find the release tag
37+ release_tag=$( echo " $release " | grep -o " \" tag_name\" :\s*\" [^\" ]*\" " | cut -d ' "' -f 4)
38+ printf " Found latest release version: $release_tag \n"
3939
40- printf " Fetching release information for parseable...\n"
41-
42- # Loop through binaries in the release and find the appropriate one
43- for arch_os in " ${CPU_ARCH} -${OS} " ; do
44- binary_name=" ${BINARIES[$arch_os]} "
45- download_url=$( echo " $release " | grep -o " \" browser_download_url\" :\s*\" [^\" ]*${binary_name} \" " | cut -d ' "' -f 4)
46- if [ -n " $download_url " ]; then
47- break
48- fi
49- done
40+ download_url=${DOWNLOAD_BASE_URL}${CPU_ARCH} -${OS} .${release_tag}
5041
51- printf " Checking for existing installation...\n"
5242if [[ -d ${INSTALL_DIR} ]]; then
5343 printf " A Previous version of parseable already exists. Run 'parseable --version' to check the version."
54- printf " or consider removing that before Installing "
44+ printf " or consider removing that before new installation\n "
5545 exit 1
56-
5746else
58- printf " No Previous installation found\n"
59- printf " Installing parseable...\n"
6047 mkdir -p ${BIN_DIR}
6148fi
6249
63-
6450# Download the binary using curl or wget
51+ printf " Downloading Parseable version $release_tag , for OS: $OS , CPU architecture: $CPU_ARCH \n\n"
6552if command -v curl & > /dev/null; then
66- curl -L -o " ${BIN_NAME} " " $download_url " 2 & >> /dev/null
53+ curl -L -o " ${BIN_NAME} " " $download_url "
6754elif command -v wget & > /dev/null; then
68- wget -O " ${BIN_NAME} " " $download_url " 2 & >> /dev/null
55+ wget -O " ${BIN_NAME} " " $download_url "
6956else
7057 echo " Error: Neither curl nor wget found. Please install either curl or wget."
7158 exit 1
@@ -79,4 +66,4 @@ printf "Adding parseable to the path\n"
7966PATH_STR=" export PATH=${BIN_DIR} " ' :$PATH'
8067echo ${PATH_STR} >> ${RC_FILE_PATH}
8168
82- echo " parseable was added to the path. Please refresh the environment by sourcing the ${RC_PATH } "
69+ echo " parseable was added to the path. Please refresh the environment by sourcing the ${RC_FILE_PATH } "
0 commit comments