Skip to content

Commit a0b4e2d

Browse files
committed
Add update_libchdb
1 parent 16ed1f8 commit a0b4e2d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

update_libchdb.sh

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

0 commit comments

Comments
 (0)