Skip to content

Try to prepare sha256 and use it on install #801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ name=languageclient

try_curl() {
command -v curl > /dev/null && \
curl --fail --location "$1" --output bin/$name
curl --fail --location "$1" --output bin/$name && \
curl --fail --location "$1.sha256" --output bin/$name.sha256
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed to cleanup previous sha256 before downloading? Like the current cleanup of bin file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the --output from curl and --output-document from wget the file will be overwritten so I don't think its useful but if you think its safer let me know

}

try_wget() {
command -v wget > /dev/null && \
wget --output-document=bin/$name "$1"
wget --output-document=bin/$name "$1" && \
wget --output-document=bin/$name.sha256 "$1.sha256"
}

download() {
echo "Downloading bin/${name}..."
url=https://github.com/autozimu/LanguageClient-neovim/releases/download/$version/${1}
if (try_curl "$url" || try_wget "$url"); then
sha256sum -c "bin/$name.sha256" || (echo "bin/$name.sha256 file checksum does not match exiting." && exit 1)
chmod a+x bin/$name
return
else
Expand Down