33# supported CPU architectures and operating systems
44SUPPORTED_ARCH=(" x86_64" " arm64" )
55SUPPORTED_OS=(" linux" " darwin" )
6- DOWNLOAD_BASE_URL=" cdn.parseable.com/"
6+ DOWNLOAD_BASE_URL=" https://github.com/parseablehq/parseable/releases/download"
7+ ARM_APPLE_PREFIX=" Parseable_OSS_aarch64-apple-darwin"
8+ INTEL_APPLE_PREFIX=" Parseable_OSS_x86_64-apple-darwin"
9+ ARM_LINUX_PREFIX=" Parseable_OSS_aarch64-unknown-linux-gnu"
10+ INTEL_LINUX_PREFIX=" Parseable_OSS_x86_64-unknown-linux-gnu"
11+ PARSEABLE_PREFIX=${ARM_APPLE_PREFIX}
712
813# Get the system's CPU architecture and operating system
914CPU_ARCH=$( uname -m)
3540release=$( curl -s " https://api.github.com/repos/parseablehq/parseable/releases/latest" )
3641# find the release tag
3742release_tag=$( echo " $release " | grep -o " \" tag_name\" :\s*\" [^\" ]*\" " | cut -d ' "' -f 4)
38- printf " Found latest release version: $release_tag \n"
43+ if [[ -z " $release_tag " ]]; then
44+ echo " Error: Could not determine the latest release version."
45+ exit 1
46+ fi
47+
48+ printf " Latest Parseable version: $release_tag \n"
3949
40- download_url=${DOWNLOAD_BASE_URL}${CPU_ARCH} -${OS} .${release_tag}
50+ # Determine the appropriate binary prefix based on OS and CPU architecture
51+ declare -A PREFIX_MAP=(
52+ [" darwin_arm64" ]=$ARM_APPLE_PREFIX
53+ [" darwin_x86_64" ]=$INTEL_APPLE_PREFIX
54+ [" linux_arm64" ]=$ARM_LINUX_PREFIX
55+ [" linux_x86_64" ]=$INTEL_LINUX_PREFIX
56+ )
57+ key=" ${OS} _${CPU_ARCH} "
58+ PARSEABLE_PREFIX=${PREFIX_MAP[$key]:- " " } || {
59+ echo " Error: unsupported platform $OS /$CPU_ARCH " ; exit 1;
60+ }
61+
62+ download_url=${DOWNLOAD_BASE_URL} /${release_tag} /${PARSEABLE_PREFIX}
4163
4264if [[ -d ${INSTALL_DIR} ]]; then
4365 printf " A Previous version of parseable already exists. Run 'parseable --version' to check the version."
4870fi
4971
5072# Download the binary using curl or wget
51- printf " Downloading Parseable version $release_tag , for OS: $OS , CPU architecture: $CPU_ARCH \n\n"
73+ printf " Downloading Parseable version $release_tag , for OS: $OS , CPU architecture: $CPU_ARCH \n"
74+ printf " Download URL: $download_url \n\n"
75+
5276if command -v curl & > /dev/null; then
53- curl -L -o " ${BIN_NAME} " " $download_url "
77+ curl -fL -o " ${BIN_NAME} " " $download_url " || { echo " Error: download failed " ; exit 1 ; }
5478elif command -v wget & > /dev/null; then
55- wget -O " ${BIN_NAME} " " $download_url "
79+ wget -q - O " ${BIN_NAME} " " $download_url " || { echo " Error: download failed " ; exit 1 ; }
5680else
5781 echo " Error: Neither curl nor wget found. Please install either curl or wget."
5882 exit 1
@@ -62,8 +86,6 @@ printf "Parseable Server was successfully installed at: ${BIN_NAME}\n"
6286
6387chmod +x " ${BIN_NAME} "
6488
65- printf " Adding parseable to the path\n"
6689PATH_STR=" export PATH=${BIN_DIR} " ' :$PATH'
6790echo ${PATH_STR} >> ${RC_FILE_PATH}
68-
69- echo " parseable was added to the path. Please refresh the environment by sourcing the ${RC_FILE_PATH} "
91+ source ${RC_FILE_PATH}
0 commit comments