1515
1616function display_help() {
1717 cat << EOM
18- Usage: $0 -v <nvim-version> -d <download-path> -o <os-name> -t <download-type>
18+ Usage: $0 -v <nvim-version> -d <download-path> -o <os-name> -t <download-type> -a <architecture>
1919Options:
2020 -v Specify the desired Neovim version to download.
2121 -d Specify directory inside which Neovim release should be downloaded.
@@ -43,11 +43,13 @@ function download_neovim() {
4343 local version=" $2 "
4444 local download_dir=" $3 "
4545 local arch_type=" $4 "
46- local download_url=" "
4746 local download_path=" "
47+ local file_name=" "
48+
49+ local download_base_url=" https://github.com/neovim/neovim/releases/download"
4850
4951 if [ " $os " == " Linux" ]; then
50- download_url= " https://github.com/neovim/neovim/releases/download/ ${version} / nvim.appimage"
52+ file_name= " nvim.appimage"
5153 download_path=" $download_dir /nvim-$version -linux.appimage"
5254
5355 set +e # Prevent termination based on compare_version's return
@@ -56,11 +58,11 @@ function download_neovim() {
5658 set -e # Re-enable termination based on return values
5759
5860 if [[ $version == " nightly" ]] || [[ $version == " stable" ]] || [[ $result -eq 1 ]]; then
59- download_url= " https://github.com/neovim/neovim/releases/download/ ${version} / nvim-linux-${arch_type} .appimage"
61+ file_name= " nvim-linux-${arch_type} .appimage"
6062 download_path=" $download_dir /nvim-$version -linux-$arch_type .appimage"
6163 fi
6264 elif [ " $os " == " Darwin" ]; then
63- download_url= " https://github.com/neovim/neovim/releases/download/ ${version} / nvim-macos.tar.gz"
65+ file_name= " nvim-macos.tar.gz"
6466 download_path=" $download_dir /nvim-$version -macos.tar.gz"
6567
6668 set +e # Prevent termination based on compare_version's return
@@ -69,14 +71,16 @@ function download_neovim() {
6971 set -e # Re-enable termination based on return values
7072
7173 if [[ $version == " nightly" ]] || [[ $version == " stable" ]] || [[ $result -eq 1 ]]; then
72- download_url= " https://github.com/neovim/neovim/releases/download/ ${version} / nvim-macos-${arch_type} .tar.gz"
74+ file_name= " nvim-macos-${arch_type} .tar.gz"
7375 download_path=" $download_dir /nvim-$version -macos-$arch_type .tar.gz"
7476 fi
7577 else
7678 echo " Error: Currently download support is present only for Linux and macOS"
7779 exit 1
7880 fi
7981
82+ local download_url=" $download_base_url /${version} /$file_name "
83+
8084 local checksum_path=" $download_path " .sha256sum
8185 local expected_checksum=" "
8286 # This ensures that they do not match
@@ -94,8 +98,20 @@ function download_neovim() {
9498
9599 echo " Downloading Neovim..."
96100 download " $download_url " " $download_path "
97- if [[ $version != " nightly" ]]; then
98- # Nightly versions do not come with checksums
101+
102+ set +e # Prevent termination based on compare_version's return
103+ compare_versions " $version " v0.10.4
104+ local result=$?
105+ set -e # Re-enable termination based on return values
106+
107+ if [[ $version == " nightly" ]] || [[ $version == " stable" ]] || [[ $result -eq 1 ]]; then
108+ # Since v0.11.0, checksums are gathered in shasum.txt,
109+ # so we need to extract the checksum from it
110+ local temp_path=" $download_path " .sha256sum.tmp
111+ download " $download_base_url /${version} /shasum.txt" " $temp_path "
112+ cat $temp_path | grep " $file_name \$ " >> " $checksum_path "
113+ rm $temp_path
114+ else
99115 download " $download_url " .sha256sum " $checksum_path "
100116 fi
101117 echo " Download completed."
0 commit comments