|
3 | 3 | # supported CPU architectures and operating systems
|
4 | 4 | SUPPORTED_ARCH=("x86_64" "arm64")
|
5 | 5 | SUPPORTED_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 | +INTEL_WINDOWS_PREFIX="Parseable_OSS_x86_64-pc-windows-msvc.exe" |
| 12 | +PARSEABLE_PREFIX=${ARM_APPLE_PREFIX} |
7 | 13 |
|
8 | 14 | # Get the system's CPU architecture and operating system
|
9 | 15 | CPU_ARCH=$(uname -m)
|
|
35 | 41 | release=$(curl -s "https://api.github.com/repos/parseablehq/parseable/releases/latest")
|
36 | 42 | # find the release tag
|
37 | 43 | release_tag=$(echo "$release" | grep -o "\"tag_name\":\s*\"[^\"]*\"" | cut -d '"' -f 4)
|
38 |
| -printf "Found latest release version: $release_tag\n" |
| 44 | +if [[ -z "$release_tag" ]]; then |
| 45 | + echo "Error: Could not determine the latest release version." |
| 46 | + exit 1 |
| 47 | +fi |
39 | 48 |
|
40 |
| -download_url=${DOWNLOAD_BASE_URL}${CPU_ARCH}-${OS}.${release_tag} |
| 49 | +printf "Latest Parseable version: $release_tag\n" |
| 50 | + |
| 51 | +# Determine the appropriate binary prefix based on OS and CPU architecture |
| 52 | +if [[ "$OS" == "darwin" ]]; then |
| 53 | + if [[ "$CPU_ARCH" == "arm64" ]]; then |
| 54 | + PARSEABLE_PREFIX=${ARM_APPLE_PREFIX} |
| 55 | + elif [[ "$CPU_ARCH" == "x86_64" ]]; then |
| 56 | + PARSEABLE_PREFIX=${INTEL_APPLE_PREFIX} |
| 57 | + else |
| 58 | + echo "Error: Unsupported CPU architecture for macOS (${CPU_ARCH})." |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | +elif [[ "$OS" == "linux" ]]; then |
| 62 | + if [[ "$CPU_ARCH" == "arm64" ]]; then |
| 63 | + PARSEABLE_PREFIX=${ARM_LINUX_PREFIX} |
| 64 | + elif [[ "$CPU_ARCH" == "x86_64" ]]; then |
| 65 | + PARSEABLE_PREFIX=${INTEL_LINUX_PREFIX} |
| 66 | + else |
| 67 | + echo "Error: Unsupported CPU architecture for Linux (${CPU_ARCH})." |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | +elif [[ "$OS" == "windows" ]]; then |
| 71 | + if [[ "$CPU_ARCH" == "x86_64" ]]; then |
| 72 | + PARSEABLE_PREFIX=${INTEL_WINDOWS_PREFIX} |
| 73 | + else |
| 74 | + echo "Error: Unsupported CPU architecture for Windows (${CPU_ARCH})." |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | +else |
| 78 | + echo "Error: Unsupported operating system (${OS})." |
| 79 | + exit 1 |
| 80 | +fi |
| 81 | + |
| 82 | +download_url=${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_PREFIX} |
41 | 83 |
|
42 | 84 | if [[ -d ${INSTALL_DIR} ]]; then
|
43 | 85 | printf "A Previous version of parseable already exists. Run 'parseable --version' to check the version."
|
|
48 | 90 | fi
|
49 | 91 |
|
50 | 92 | # Download the binary using curl or wget
|
51 |
| -printf "Downloading Parseable version $release_tag, for OS: $OS, CPU architecture: $CPU_ARCH\n\n" |
| 93 | +printf "Downloading Parseable version $release_tag, for OS: $OS, CPU architecture: $CPU_ARCH\n" |
| 94 | +printf "Download URL: $download_url\n\n" |
| 95 | + |
52 | 96 | if command -v curl &>/dev/null; then
|
53 | 97 | curl -L -o "${BIN_NAME}" "$download_url"
|
54 | 98 | elif command -v wget &>/dev/null; then
|
55 | 99 | wget -O "${BIN_NAME}" "$download_url"
|
56 | 100 | else
|
57 | 101 | echo "Error: Neither curl nor wget found. Please install either curl or wget."
|
58 |
| - exit 1 |
59 | 102 | fi
|
60 | 103 |
|
61 | 104 | printf "Parseable Server was successfully installed at: ${BIN_NAME}\n"
|
62 | 105 |
|
63 | 106 | chmod +x "${BIN_NAME}"
|
64 | 107 |
|
65 |
| -printf "Adding parseable to the path\n" |
66 | 108 | PATH_STR="export PATH=${BIN_DIR}"':$PATH'
|
67 | 109 | echo ${PATH_STR} >> ${RC_FILE_PATH}
|
68 |
| - |
69 |
| -echo "parseable was added to the path. Please refresh the environment by sourcing the ${RC_FILE_PATH}" |
| 110 | +source ${RC_FILE_PATH} |
0 commit comments