forked from autozimu/LanguageClient-neovim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·52 lines (44 loc) · 1.39 KB
/
install.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
44
45
46
47
48
49
50
51
52
#!/usr/bin/env sh
# Try install by
# - download binary
# - build with cargo
set -o nounset # error when referencing undefined variable
set -o errexit # exit when command fails
version=0.1.143
name=languageclient
try_curl() {
command -v curl > /dev/null && \
curl --fail --location "$1" --output bin/$name
}
try_wget() {
command -v wget > /dev/null && \
wget --output-document=bin/$name "$1"
}
download() {
echo "Downloading bin/${name}..."
url=https://github.com/autozimu/LanguageClient-neovim/releases/download/$version/${1}
if (try_curl "$url" || try_wget "$url"); then
chmod a+x bin/$name
return
else
try_build || echo "Prebuilt binary might not be ready yet. Please check minutes later."
fi
}
try_build() {
if command -v cargo > /dev/null; then
echo "Trying build locally ..."
make release
else
return 1
fi
}
rm -f bin/languageclient
arch=$(uname -sm)
case "${arch}" in
"Linux x86_64") download $name-$version-x86_64-unknown-linux-musl ;;
"Linux i686") download $name-$version-i686-unknown-linux-musl ;;
"Linux aarch64") download $name-$version-aarch64-unknown-linux-gnu ;;
"Darwin x86_64") download $name-$version-x86_64-apple-darwin ;;
"FreeBSD amd64") download $name-$version-x86_64-unknown-freebsd ;;
*) echo "No pre-built binary available for ${arch}."; try_build ;;
esac