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
+ PARSEABLE_PREFIX=${ARM_APPLE_PREFIX}
7
12
8
13
# Get the system's CPU architecture and operating system
9
14
CPU_ARCH=$( uname -m)
35
40
release=$( curl -s " https://api.github.com/repos/parseablehq/parseable/releases/latest" )
36
41
# find the release tag
37
42
release_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"
39
49
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}
41
63
42
64
if [[ -d ${INSTALL_DIR} ]]; then
43
65
printf " A Previous version of parseable already exists. Run 'parseable --version' to check the version."
48
70
fi
49
71
50
72
# 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
+
52
76
if 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 ; }
54
78
elif 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 ; }
56
80
else
57
81
echo " Error: Neither curl nor wget found. Please install either curl or wget."
58
82
exit 1
@@ -62,8 +86,6 @@ printf "Parseable Server was successfully installed at: ${BIN_NAME}\n"
62
86
63
87
chmod +x " ${BIN_NAME} "
64
88
65
- printf " Adding parseable to the path\n"
66
89
PATH_STR=" export PATH=${BIN_DIR} " ' :$PATH'
67
90
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} "
91
+ source ${RC_FILE_PATH}
0 commit comments