-
Notifications
You must be signed in to change notification settings - Fork 8
/
install
executable file
·46 lines (35 loc) · 1.21 KB
/
install
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
44
45
46
#!/usr/bin/env sh
set -u
type curl > /dev/null || { echo "curl: not found"; exit 1; }
repo='longbridge/longbridge-terminal'
get_latest_release() {
curl --silent "https://api.github.com/repos/$repo/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
bin_name='longbridge'
version='v0.6.0'
platform="$(uname | tr "[A-Z]" "[a-z]")" # Linux => linux
arch="$(uname -m | sed 's/x86_64/amd64/')" # x86_64 => amd64
if [ "$platform" = "darwin" ]; then
arch="universal"
fi
echo "Downloading $bin_name@$version ..."
libc=''
# if ldd --version 2>&1 | grep -q 'musl'; then
# libc='-musl'
# fi
download_url=https://github.com/$repo/releases/download/$version/$bin_name-$platform$libc-$arch.tar.gz
echo $download_url
curl -Lo $bin_name.tar.gz $download_url
tar zxf $bin_name.tar.gz
if test $(id -u) -eq 0; then
mv $bin_name /usr/local/bin/$bin_name
else
sudo mv $bin_name /usr/local/bin/$bin_name
fi
rm $bin_name.tar.gz
echo "Longbridge Terminal $version has installed successfully."
echo ""
echo "You can use `longbridge -h` to get help."
echo ""