feat: add installation script for neovim
Added a simple script to install neovim from the GitHub Releases page as a replacement for building it from scratch.
This commit is contained in:
parent
7b59918e80
commit
179dcb9aa9
1 changed files with 48 additions and 0 deletions
48
scripts/install-neovim
Executable file
48
scripts/install-neovim
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bi/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
if [ -z ${1+x} ]; then
|
||||
echo "ERROR: Please specify the version of neovim that you want to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$( echo ${1} | sed 's/v//g')"
|
||||
|
||||
echo "Installing neovim version ${VERSION}"
|
||||
|
||||
INSTALLATION_DIR="${HOME}/.local/opt/nvim"
|
||||
SYMLINK="${HOME}/.local/bin/nvim"
|
||||
DOWNLOAD_DIR="${HOME}/Downloads/nvim-${VERSION}"
|
||||
|
||||
if [[ -d "${INSTALLATION_DIR}" ]]; then
|
||||
echo "Moving ${INSTALLATION_DIR} to ${INSTALLATION_DIR}.previous"
|
||||
mv "${INSTALLATION_DIR}" "${INSTALLATION_DIR}.previous"
|
||||
fi
|
||||
|
||||
echo "Creating ${INSTALLATION_DIR}"
|
||||
mkdir "${INSTALLATION_DIR}"
|
||||
|
||||
echo "Downloading neovim to ${DOWNLOAD_DIR}"
|
||||
mkdir "${DOWNLOAD_DIR}"
|
||||
curl -s \
|
||||
-L "https://github.com/neovim/neovim/releases/download/v${VERSION}/nvim-linux64.tar.gz" \
|
||||
-o "${DOWNLOAD_DIR}/nvim-linux64.tar.gz"
|
||||
|
||||
curl -s \
|
||||
-L "https://github.com/neovim/neovim/releases/download/v${VERSION}/nvim-linux64.tar.gz.sha256sum" \
|
||||
-o "${DOWNLOAD_DIR}/nvim-linux64.tar.gz.sha256sum"
|
||||
|
||||
echo "Verifying the package"
|
||||
cd "${DOWNLOAD_DIR}"
|
||||
sha256sum --check nvim-linux64.tar.gz.sha256sum
|
||||
|
||||
# extract contents to the installation directory
|
||||
echo "Extracting the package to ${INSTALLATION_DIR}"
|
||||
tar xzf "${DOWNLOAD_DIR}/nvim-linux64.tar.gz" --strip-components=1 -C ${INSTALLATION_DIR}
|
||||
|
||||
# create the symlink
|
||||
echo "Creating the symbolic link ${SYMLINK}"
|
||||
ln -sf ${INSTALLATION_DIR}/bin/nvim ${SYMLINK}
|
Loading…
Reference in a new issue