-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_libchdb.sh
executable file
·43 lines (34 loc) · 1.04 KB
/
update_libchdb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Get the newest release version
LATEST_RELEASE=$(curl --silent "https://github.com/gitapi/repos/chdb-io/chdb/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# Download the correct version based on the platform
case "$(uname -s)" in
Linux)
if [[ $(uname -m) == "aarch64" ]]; then
PLATFORM="linux-aarch64-libchdb.tar.gz"
else
PLATFORM="linux-x86_64-libchdb.tar.gz"
fi
;;
Darwin)
if [[ $(uname -m) == "arm64" ]]; then
PLATFORM="macos-arm64-libchdb.tar.gz"
else
PLATFORM="macos-x86_64-libchdb.tar.gz"
fi
;;
*)
echo "Unsupported platform"
exit 1
;;
esac
DOWNLOAD_URL="https://github.com/chdb-io/chdb/releases/download/$LATEST_RELEASE/$PLATFORM"
echo "Downloading $PLATFORM from $DOWNLOAD_URL"
# Download the file
curl -L -o libchdb.tar.gz $DOWNLOAD_URL
# Untar the file
tar -xzf libchdb.tar.gz
# Set execute permission for libchdb.so
chmod +x libchdb.so
# Clean up
rm -f libchdb.tar.gz