From 1a3e0c4c0f150a8535aac71ccfb66802523fab44 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 17 Mar 2025 19:57:16 +0100 Subject: [PATCH] fix: again --- installs/neovim.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/installs/neovim.sh b/installs/neovim.sh index fffdd43..15de15f 100755 --- a/installs/neovim.sh +++ b/installs/neovim.sh @@ -107,28 +107,40 @@ inst_generic() { tempdir="$(mktemp -d)" - if [ ! -d "$HOME/.bin" ]; then - mkdir "$HOME/.bin" + mkdir -p "$HOME/.bin" fi echo_info "Fetching latest stable Neovim version..." latest_version=$(curl -s https://api.github.com/repos/neovim/neovim/releases/latest | grep 'tag_name' | cut -d\" -f4) - echo_info "Downloading Neovim version $latest_version..." - curl -fsSL -o "$tempdir/nvim.tar.gz" "https://github.com/neovim/neovim/releases/download/${latest_version}/nvim-linux-x86_64.tar.gz" && cd "$tempdir" - # https://github.com/neovim/neovim/releases/download/v0.10.4/nvim-linux-x86_64.tar.gz - tar -xf nvim.tar.gz - cp -r ./nvim-linux64 "$HOME/.bin" + # Download the tarball + curl -fsSL -o "$tempdir/nvim.tar.gz" "https://github.com/neovim/neovim/releases/download/${latest_version}/nvim-linux-x86_64.tar.gz" + # Change to the temporary directory and extract + cd "$tempdir" + tar -xzf nvim.tar.gz + + # Remove old installation if it exists + rm -rf "$HOME/.bin/nvim-linux64" + + # Copy to destination + cp -r ./nvim-linux64 "$HOME/.bin/" + + # Create symlinks with absolute paths inst_paths="/usr/bin /usr/share/bin $HOME/.local/bin" for in_path in $inst_paths; do if [ -d "$in_path" ]; then echo_info "Installing into $in_path" - $_sudo ln -r -s "$HOME/.bin/nvim-linux64/bin/nvim" "$in_path" + $_sudo ln -sf "$HOME/.bin/nvim-linux64/bin/nvim" "$in_path/nvim" fi done + + # Clean up + rm -rf "$tempdir" + + echo_info "Neovim $latest_version installed successfully" } # ─< Distribution detection and installation >────────────────────────────────────────