Skip to content

Commit 578784e

Browse files
committed
fix the download url in install script
1 parent ecdb27f commit 578784e

File tree

1 file changed

+49
-8
lines changed

1 file changed

+49
-8
lines changed

scripts/download.sh

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
# supported CPU architectures and operating systems
44
SUPPORTED_ARCH=("x86_64" "arm64")
55
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}
713

814
# Get the system's CPU architecture and operating system
915
CPU_ARCH=$(uname -m)
@@ -35,9 +41,45 @@ fi
3541
release=$(curl -s "https://api.github.com/repos/parseablehq/parseable/releases/latest")
3642
# find the release tag
3743
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
3948

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}
4183

4284
if [[ -d ${INSTALL_DIR} ]]; then
4385
printf "A Previous version of parseable already exists. Run 'parseable --version' to check the version."
@@ -48,22 +90,21 @@ else
4890
fi
4991

5092
# 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+
5296
if command -v curl &>/dev/null; then
5397
curl -L -o "${BIN_NAME}" "$download_url"
5498
elif command -v wget &>/dev/null; then
5599
wget -O "${BIN_NAME}" "$download_url"
56100
else
57101
echo "Error: Neither curl nor wget found. Please install either curl or wget."
58-
exit 1
59102
fi
60103

61104
printf "Parseable Server was successfully installed at: ${BIN_NAME}\n"
62105

63106
chmod +x "${BIN_NAME}"
64107

65-
printf "Adding parseable to the path\n"
66108
PATH_STR="export PATH=${BIN_DIR}"':$PATH'
67109
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

Comments
 (0)