From 578784e4e779ffffd4aae5d4fcc30baebfe6b39f Mon Sep 17 00:00:00 2001 From: Nitish Tiwari Date: Fri, 1 Aug 2025 14:00:55 +0530 Subject: [PATCH 1/3] fix the download url in install script --- scripts/download.sh | 57 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/scripts/download.sh b/scripts/download.sh index 6985b4473..dbb8d3dcb 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -3,7 +3,13 @@ # supported CPU architectures and operating systems SUPPORTED_ARCH=("x86_64" "arm64") SUPPORTED_OS=("linux" "darwin") -DOWNLOAD_BASE_URL="cdn.parseable.com/" +DOWNLOAD_BASE_URL="https://github.com/parseablehq/parseable/releases/download" +ARM_APPLE_PREFIX="Parseable_OSS_aarch64-apple-darwin" +INTEL_APPLE_PREFIX="Parseable_OSS_x86_64-apple-darwin" +ARM_LINUX_PREFIX="Parseable_OSS_aarch64-unknown-linux-gnu" +INTEL_LINUX_PREFIX="Parseable_OSS_x86_64-unknown-linux-gnu" +INTEL_WINDOWS_PREFIX="Parseable_OSS_x86_64-pc-windows-msvc.exe" +PARSEABLE_PREFIX=${ARM_APPLE_PREFIX} # Get the system's CPU architecture and operating system CPU_ARCH=$(uname -m) @@ -35,9 +41,45 @@ fi release=$(curl -s "https://api.github.com/repos/parseablehq/parseable/releases/latest") # find the release tag release_tag=$(echo "$release" | grep -o "\"tag_name\":\s*\"[^\"]*\"" | cut -d '"' -f 4) -printf "Found latest release version: $release_tag\n" +if [[ -z "$release_tag" ]]; then + echo "Error: Could not determine the latest release version." + exit 1 +fi -download_url=${DOWNLOAD_BASE_URL}${CPU_ARCH}-${OS}.${release_tag} +printf "Latest Parseable version: $release_tag\n" + +# Determine the appropriate binary prefix based on OS and CPU architecture +if [[ "$OS" == "darwin" ]]; then + if [[ "$CPU_ARCH" == "arm64" ]]; then + PARSEABLE_PREFIX=${ARM_APPLE_PREFIX} + elif [[ "$CPU_ARCH" == "x86_64" ]]; then + PARSEABLE_PREFIX=${INTEL_APPLE_PREFIX} + else + echo "Error: Unsupported CPU architecture for macOS (${CPU_ARCH})." + exit 1 + fi +elif [[ "$OS" == "linux" ]]; then + if [[ "$CPU_ARCH" == "arm64" ]]; then + PARSEABLE_PREFIX=${ARM_LINUX_PREFIX} + elif [[ "$CPU_ARCH" == "x86_64" ]]; then + PARSEABLE_PREFIX=${INTEL_LINUX_PREFIX} + else + echo "Error: Unsupported CPU architecture for Linux (${CPU_ARCH})." + exit 1 + fi +elif [[ "$OS" == "windows" ]]; then + if [[ "$CPU_ARCH" == "x86_64" ]]; then + PARSEABLE_PREFIX=${INTEL_WINDOWS_PREFIX} + else + echo "Error: Unsupported CPU architecture for Windows (${CPU_ARCH})." + exit 1 + fi +else + echo "Error: Unsupported operating system (${OS})." + exit 1 +fi + +download_url=${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_PREFIX} if [[ -d ${INSTALL_DIR} ]]; then printf "A Previous version of parseable already exists. Run 'parseable --version' to check the version." @@ -48,22 +90,21 @@ else fi # Download the binary using curl or wget -printf "Downloading Parseable version $release_tag, for OS: $OS, CPU architecture: $CPU_ARCH\n\n" +printf "Downloading Parseable version $release_tag, for OS: $OS, CPU architecture: $CPU_ARCH\n" +printf "Download URL: $download_url\n\n" + if command -v curl &>/dev/null; then curl -L -o "${BIN_NAME}" "$download_url" elif command -v wget &>/dev/null; then wget -O "${BIN_NAME}" "$download_url" else echo "Error: Neither curl nor wget found. Please install either curl or wget." - exit 1 fi printf "Parseable Server was successfully installed at: ${BIN_NAME}\n" chmod +x "${BIN_NAME}" -printf "Adding parseable to the path\n" PATH_STR="export PATH=${BIN_DIR}"':$PATH' echo ${PATH_STR} >> ${RC_FILE_PATH} - -echo "parseable was added to the path. Please refresh the environment by sourcing the ${RC_FILE_PATH}" +source ${RC_FILE_PATH} From 1d6c2784d66eef1cb53deb01a8243dcb3777e25f Mon Sep 17 00:00:00 2001 From: Nitish Tiwari Date: Fri, 1 Aug 2025 14:11:12 +0530 Subject: [PATCH 2/3] update --- scripts/download.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/download.sh b/scripts/download.sh index dbb8d3dcb..45ed67a93 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -8,7 +8,6 @@ ARM_APPLE_PREFIX="Parseable_OSS_aarch64-apple-darwin" INTEL_APPLE_PREFIX="Parseable_OSS_x86_64-apple-darwin" ARM_LINUX_PREFIX="Parseable_OSS_aarch64-unknown-linux-gnu" INTEL_LINUX_PREFIX="Parseable_OSS_x86_64-unknown-linux-gnu" -INTEL_WINDOWS_PREFIX="Parseable_OSS_x86_64-pc-windows-msvc.exe" PARSEABLE_PREFIX=${ARM_APPLE_PREFIX} # Get the system's CPU architecture and operating system @@ -67,13 +66,6 @@ elif [[ "$OS" == "linux" ]]; then echo "Error: Unsupported CPU architecture for Linux (${CPU_ARCH})." exit 1 fi -elif [[ "$OS" == "windows" ]]; then - if [[ "$CPU_ARCH" == "x86_64" ]]; then - PARSEABLE_PREFIX=${INTEL_WINDOWS_PREFIX} - else - echo "Error: Unsupported CPU architecture for Windows (${CPU_ARCH})." - exit 1 - fi else echo "Error: Unsupported operating system (${OS})." exit 1 @@ -94,11 +86,12 @@ printf "Downloading Parseable version $release_tag, for OS: $OS, CPU architectur printf "Download URL: $download_url\n\n" if command -v curl &>/dev/null; then - curl -L -o "${BIN_NAME}" "$download_url" + curl -fL -o "${BIN_NAME}" "$download_url" || { echo "Error: download failed"; exit 1; } elif command -v wget &>/dev/null; then - wget -O "${BIN_NAME}" "$download_url" + wget -q -O "${BIN_NAME}" "$download_url" || { echo "Error: download failed"; exit 1; } else echo "Error: Neither curl nor wget found. Please install either curl or wget." + exit 1 fi printf "Parseable Server was successfully installed at: ${BIN_NAME}\n" From e9c476b508bdfcb264daa31ebdeb4eb91347ae67 Mon Sep 17 00:00:00 2001 From: Nitish Tiwari Date: Fri, 1 Aug 2025 14:18:25 +0530 Subject: [PATCH 3/3] update --- scripts/download.sh | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/scripts/download.sh b/scripts/download.sh index 45ed67a93..f6196882c 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -48,28 +48,16 @@ fi printf "Latest Parseable version: $release_tag\n" # Determine the appropriate binary prefix based on OS and CPU architecture -if [[ "$OS" == "darwin" ]]; then - if [[ "$CPU_ARCH" == "arm64" ]]; then - PARSEABLE_PREFIX=${ARM_APPLE_PREFIX} - elif [[ "$CPU_ARCH" == "x86_64" ]]; then - PARSEABLE_PREFIX=${INTEL_APPLE_PREFIX} - else - echo "Error: Unsupported CPU architecture for macOS (${CPU_ARCH})." - exit 1 - fi -elif [[ "$OS" == "linux" ]]; then - if [[ "$CPU_ARCH" == "arm64" ]]; then - PARSEABLE_PREFIX=${ARM_LINUX_PREFIX} - elif [[ "$CPU_ARCH" == "x86_64" ]]; then - PARSEABLE_PREFIX=${INTEL_LINUX_PREFIX} - else - echo "Error: Unsupported CPU architecture for Linux (${CPU_ARCH})." - exit 1 - fi -else - echo "Error: Unsupported operating system (${OS})." - exit 1 -fi +declare -A PREFIX_MAP=( + ["darwin_arm64"]=$ARM_APPLE_PREFIX + ["darwin_x86_64"]=$INTEL_APPLE_PREFIX + ["linux_arm64"]=$ARM_LINUX_PREFIX + ["linux_x86_64"]=$INTEL_LINUX_PREFIX +) +key="${OS}_${CPU_ARCH}" +PARSEABLE_PREFIX=${PREFIX_MAP[$key]:-""} || { + echo "Error: unsupported platform $OS/$CPU_ARCH"; exit 1; +} download_url=${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_PREFIX}