ClickHouse/docs/_includes/install/universal.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
2.0 KiB
Bash
Raw Normal View History

#!/bin/sh -e
OS=$(uname -s)
ARCH=$(uname -m)
DIR=
if [ "${OS}" = "Linux" ]
then
2022-07-17 21:16:54 +00:00
if [ "${ARCH}" = "x86_64" -o "${ARCH}" = "amd64" ]
then
DIR="amd64"
2022-07-17 21:16:54 +00:00
elif [ "${ARCH}" = "aarch64" -o "${ARCH}" = "arm64" ]
then
2022-09-27 07:00:46 +00:00
# If the system has >=ARMv8.2 (https://en.wikipedia.org/wiki/AArch64), choose the corresponding build, else fall back to a v8.0
# compat build. Unfortunately, the ARM ISA level cannot be read directly, we need to guess from the "features" in /proc/cpuinfo.
# Also, the flags in /proc/cpuinfo are named differently than the flags passed to the compiler (cmake/cpu_features.cmake).
ARMV82=$(grep -m 1 'Features' /proc/cpuinfo | awk '/asimd/ && /sha1/ && /aes/ && /atomics/ && /lrcpc/')
if [ "${ARMV82}" ]
then
DIR="aarch64"
else
DIR="aarch64v80compat"
fi
2022-07-17 21:16:54 +00:00
elif [ "${ARCH}" = "powerpc64le" -o "${ARCH}" = "ppc64le" ]
then
DIR="powerpc64le"
fi
elif [ "${OS}" = "FreeBSD" ]
then
2022-07-17 21:16:54 +00:00
if [ "${ARCH}" = "x86_64" -o "${ARCH}" = "amd64" ]
then
DIR="freebsd"
fi
elif [ "${OS}" = "Darwin" ]
then
2022-07-17 21:16:54 +00:00
if [ "${ARCH}" = "x86_64" -o "${ARCH}" = "amd64" ]
then
DIR="macos"
2021-11-09 20:14:10 +00:00
elif [ "${ARCH}" = "aarch64" -o "${ARCH}" = "arm64" ]
then
DIR="macos-aarch64"
fi
fi
if [ -z "${DIR}" ]
then
echo "Operating system '${OS}' / architecture '${ARCH}' is unsupported."
exit 1
fi
clickhouse_download_filename_prefix="clickhouse"
clickhouse="$clickhouse_download_filename_prefix"
2022-12-02 22:11:08 +00:00
i=0
while [ -f "$clickhouse" ]
do
clickhouse="${clickhouse_download_filename_prefix}.${i}"
2022-12-02 22:11:08 +00:00
i=$(($i+1))
done
URL="https://builds.clickhouse.com/master/${DIR}/clickhouse"
2021-10-17 02:52:00 +00:00
echo
2022-12-02 22:11:08 +00:00
echo "Will download ${URL} into ${clickhouse}"
2021-10-17 02:52:00 +00:00
echo
2022-12-02 22:11:08 +00:00
curl "${URL}" -o "${clickhouse}" && chmod a+x "${clickhouse}" || exit 1
2021-10-17 02:52:00 +00:00
echo
echo "Successfully downloaded the ClickHouse binary, you can run it as:
2022-12-02 22:11:08 +00:00
./${clickhouse}"
if [ "${OS}" = "Linux" ]
then
2021-10-17 02:52:00 +00:00
echo
echo "You can also install it:
2022-12-02 22:11:08 +00:00
sudo ./${clickhouse} install"
fi