Fix error handling of install script
Close
@@ -9,6 +9,8 @@ set -o errexit # exit when command fails
version=0.1.157
name=languageclient
+arch=$(uname -sm)
+
try_curl() {
command -v curl > /dev/null && \
curl --fail --location "$1" --output bin/$name
@@ -20,13 +22,14 @@ try_wget() {
}
download() {
- echo "Downloading bin/${name} ${version}..."
+ echo "Tring download bin/${name} ${version}..."
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."
+ echo "Prebuilt binary is not available for:" "${arch}"
+ try_build
fi
}
@@ -35,6 +38,7 @@ try_build() {
echo "Trying build locally ${version} ..."
make release
else
+ echo "cargo is not available. Abort."
return 1
fi
}
@@ -48,7 +52,6 @@ if [ -f "$bin" ]; then
esac
fi
-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 ;;
