- 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>
69 lines
1.7 KiB
Bash
Executable File
69 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "============================================"
|
|
echo "VisiData Installation Script"
|
|
echo "============================================"
|
|
echo ""
|
|
echo "This script will run the following commands with sudo:"
|
|
echo " - apt-get update (if pipx not installed)"
|
|
echo " - apt-get install -y pipx (if needed)"
|
|
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 if python3 is available
|
|
if ! command -v python3 &> /dev/null; then
|
|
set +x
|
|
echo "Error: python3 is not installed. Please install Python 3 first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Install pipx if not available (recommended way to install VisiData)
|
|
if ! command -v pipx &> /dev/null; then
|
|
sudo apt-get update
|
|
sudo apt-get install -y pipx
|
|
set +x
|
|
pipx ensurepath
|
|
set -x
|
|
fi
|
|
|
|
set +x
|
|
|
|
# Install VisiData using pipx
|
|
echo "Installing VisiData via pipx..."
|
|
set -x
|
|
pipx install visidata
|
|
|
|
# Disable command tracing for cleaner output
|
|
set +x
|
|
|
|
echo ""
|
|
echo "============================================"
|
|
# Verify installation
|
|
if command -v vd &> /dev/null; then
|
|
echo "VisiData installed successfully!"
|
|
vd --version
|
|
echo ""
|
|
echo "Note: If 'vd' command is not found, you may need to:"
|
|
echo " 1. Restart your shell, or"
|
|
echo " 2. Run: source ~/.bashrc"
|
|
else
|
|
echo "Warning: VisiData installed but 'vd' command not in PATH" >&2
|
|
echo "You may need to restart your shell or run: source ~/.bashrc" >&2
|
|
fi
|
|
echo ""
|
|
echo "Documentation: https://www.visidata.org/"
|
|
echo "============================================"
|