Skip to content

Commit e9c476b

Browse files
committed
update
1 parent 1d6c278 commit e9c476b

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

scripts/download.sh

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,16 @@ fi
4848
printf "Latest Parseable version: $release_tag\n"
4949

5050
# Determine the appropriate binary prefix based on OS and CPU architecture
51-
if [[ "$OS" == "darwin" ]]; then
52-
if [[ "$CPU_ARCH" == "arm64" ]]; then
53-
PARSEABLE_PREFIX=${ARM_APPLE_PREFIX}
54-
elif [[ "$CPU_ARCH" == "x86_64" ]]; then
55-
PARSEABLE_PREFIX=${INTEL_APPLE_PREFIX}
56-
else
57-
echo "Error: Unsupported CPU architecture for macOS (${CPU_ARCH})."
58-
exit 1
59-
fi
60-
elif [[ "$OS" == "linux" ]]; then
61-
if [[ "$CPU_ARCH" == "arm64" ]]; then
62-
PARSEABLE_PREFIX=${ARM_LINUX_PREFIX}
63-
elif [[ "$CPU_ARCH" == "x86_64" ]]; then
64-
PARSEABLE_PREFIX=${INTEL_LINUX_PREFIX}
65-
else
66-
echo "Error: Unsupported CPU architecture for Linux (${CPU_ARCH})."
67-
exit 1
68-
fi
69-
else
70-
echo "Error: Unsupported operating system (${OS})."
71-
exit 1
72-
fi
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+
}
7361

7462
download_url=${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_PREFIX}
7563

0 commit comments

Comments
 (0)