- Use modern signed-by method for PostgreSQL GPG keys - Auto-detect latest Python 3 version from deadsnakes PPA - Add command tracing (set -x) to show all commands as they run - Display sudo commands upfront before execution - Add user confirmation prompts (y/N) before installation - Improve error handling with set -euo pipefail - Add proper cleanup and verification steps - Use pipx for VisiData installation - Better output formatting with clear section headers Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
80 lines
2.0 KiB
Bash
Executable File
80 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "============================================"
|
|
echo "Neovim Latest Installation Script"
|
|
echo "============================================"
|
|
echo ""
|
|
echo "This script will run the following commands with sudo:"
|
|
echo " - apt-get update (if curl not installed)"
|
|
echo " - apt-get install -y curl (if needed)"
|
|
echo " - rm -rf /opt/nvim-linux64 (if old installation exists)"
|
|
echo " - tar -C /opt -xzf nvim-linux64.tar.gz"
|
|
echo ""
|
|
read -p "Continue with installation? (y/N) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "Installation cancelled."
|
|
exit 0
|
|
fi
|
|
|
|
echo ""
|
|
echo "Starting installation (commands will be shown as they run)..."
|
|
echo ""
|
|
|
|
# Enable command tracing
|
|
set -x
|
|
|
|
# Check for required tools
|
|
if ! command -v curl &> /dev/null; then
|
|
sudo apt-get update
|
|
sudo apt-get install -y curl
|
|
fi
|
|
|
|
# Disable tracing temporarily for cleaner download messages
|
|
set +x
|
|
|
|
# Download latest Neovim
|
|
echo "Downloading Neovim..."
|
|
TEMP_DIR=$(mktemp -d)
|
|
cd "$TEMP_DIR"
|
|
|
|
if ! curl -fsSL -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz; then
|
|
echo "Error: Failed to download Neovim" >&2
|
|
rm -rf "$TEMP_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Download complete."
|
|
set -x
|
|
|
|
# Remove old installation if it exists
|
|
if [ -d /opt/nvim-linux64 ]; then
|
|
sudo rm -rf /opt/nvim-linux64
|
|
fi
|
|
|
|
# Extract to /opt
|
|
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
|
|
|
set +x
|
|
|
|
# Clean up
|
|
cd - > /dev/null
|
|
rm -rf "$TEMP_DIR"
|
|
|
|
echo ""
|
|
echo "============================================"
|
|
# Verify installation
|
|
if [ -x /opt/nvim-linux64/bin/nvim ]; then
|
|
echo "Neovim installed successfully!"
|
|
/opt/nvim-linux64/bin/nvim --version | head -n1
|
|
echo ""
|
|
echo "Neovim is installed at: /opt/nvim-linux64/bin/nvim"
|
|
echo "Add to PATH by adding this to your ~/.bashrc:"
|
|
echo ' export PATH="$PATH:/opt/nvim-linux64/bin"'
|
|
else
|
|
echo "Error: Neovim installation failed" >&2
|
|
exit 1
|
|
fi
|
|
echo "============================================"
|