Scope update-neovim.sh to debian: arch gets neovim from pacman; guard no-ops elsewhere
This commit is contained in:
parent
f692fbf01e
commit
a223473fc2
3 changed files with 121 additions and 2 deletions
|
|
@ -200,8 +200,54 @@ if command -v bun >/dev/null 2>&1; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Neovim comes from the system package (pacman list above); topgrade keeps
|
||||
# it current. No manual tarball install.
|
||||
# Neovim — debian apt ships a stale version, so install the official
|
||||
# binary tarball, pinned to a known-good version. Bump
|
||||
# NVIM_TARGET_VERSION here and in ~/.local/bin/update-neovim.sh to
|
||||
# upgrade (topgrade runs the script on debian machines).
|
||||
NVIM_TARGET_VERSION="v0.11.4"
|
||||
ARCH="$(uname -m)"
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
NVIM_TARBALL="nvim-linux64.tar.gz"
|
||||
NVIM_EXTRACT_DIR="nvim-linux64"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
NVIM_TARBALL="nvim-linux-arm64.tar.gz"
|
||||
NVIM_EXTRACT_DIR="nvim-linux-arm64"
|
||||
;;
|
||||
*)
|
||||
die "unsupported arch for neovim tarball: $ARCH"
|
||||
;;
|
||||
esac
|
||||
|
||||
if command -v nvim >/dev/null 2>&1; then
|
||||
INSTALLED_VER="$(nvim --version 2>/dev/null | head -1 | awk '{print $2}')"
|
||||
if [[ "$INSTALLED_VER" == "$NVIM_TARGET_VERSION" ]]; then
|
||||
log "neovim $INSTALLED_VER matches target — skipping"
|
||||
NVIM_TARBALL=""
|
||||
else
|
||||
log "neovim $INSTALLED_VER != target $NVIM_TARGET_VERSION — upgrading"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$NVIM_TARBALL" ]]; then
|
||||
log "downloading neovim $NVIM_TARGET_VERSION ($NVIM_TARBALL)"
|
||||
cd /tmp
|
||||
if ! curl -fL --retry 3 \
|
||||
"https://github.com/neovim/neovim/releases/download/${NVIM_TARGET_VERSION}/${NVIM_TARBALL}" \
|
||||
-o nvim.tar.gz; then
|
||||
die "failed to download neovim tarball"
|
||||
fi
|
||||
sudo rm -rf /opt/nvim-linux* /usr/local/bin/nvim
|
||||
sudo tar -xzf nvim.tar.gz -C /opt/
|
||||
sudo ln -sf "/opt/${NVIM_EXTRACT_DIR}/bin/nvim" /usr/local/bin/nvim
|
||||
rm -f nvim.tar.gz
|
||||
fi
|
||||
|
||||
# Verify neovim is reachable (PATH may need /usr/local/bin explicitly for this run)
|
||||
if ! command -v nvim >/dev/null 2>&1 && [[ -x /usr/local/bin/nvim ]]; then
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
fi
|
||||
|
||||
{{ else -}}
|
||||
die "unsupported os_family: {{ .os_family }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue