-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathinstall_flatc.sh
39 lines (36 loc) · 1.12 KB
/
install_flatc.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
#!/bin/bash
#
# Copyright 2024, AutoMQ HK Limited.
#
# Use of this software is governed by the Business Source License
# included in the file BSL.md
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0
#
set -e
if [ "$EUID" -ne 0 ]
then echo "To install dependencies, you need to run as root. Please try running with sudo: sudo $0"
fi
if [ ! -f /usr/local/bin/flatc ]; then
apt update
apt install -y unzip clang
arch=$(uname -m)
if [ "$arch" == "arm64" ]; then
echo "Host arch is arm64"
wget -O flatc.zip https://github.com/google/flatbuffers/releases/download/v23.5.26/Mac.flatc.binary.zip
elif [ "$arch" == "x86_64" ]; then
echo "Host arch is amd64"
wget -O flatc.zip https://github.com/google/flatbuffers/releases/download/v23.5.26/Linux.flatc.binary.clang++-12.zip
else
echo "Unsupported arch"
exit 1
fi
unzip flatc.zip
mv flatc /usr/local/bin/
rm flatc.zip
echo "install flatc successfully"
else
echo "flatc exists"
fi