improve install scripts with modern practices and transparency
- 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>
This commit is contained in:
parent
c6d2eeb5fc
commit
abaf266904
@ -1,3 +1,81 @@
|
|||||||
sudo apt install zip
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
curl -s "https://get.sdkman.io" | bash
|
echo "============================================"
|
||||||
|
echo "SDKMAN (Java Development) Installation Script"
|
||||||
|
echo "============================================"
|
||||||
|
echo ""
|
||||||
|
echo "This script will run the following commands with sudo:"
|
||||||
|
echo " - apt-get update"
|
||||||
|
echo " - apt-get install -y zip unzip curl"
|
||||||
|
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
|
||||||
|
|
||||||
|
# Install prerequisites
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y zip unzip curl
|
||||||
|
|
||||||
|
set +x
|
||||||
|
|
||||||
|
# Check if SDKMAN is already installed
|
||||||
|
if [ -d "$HOME/.sdkman" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "============================================"
|
||||||
|
echo "SDKMAN is already installed at ~/.sdkman"
|
||||||
|
echo "To update SDKMAN, run: sdk selfupdate"
|
||||||
|
echo "============================================"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install SDKMAN
|
||||||
|
echo "Installing SDKMAN..."
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if ! curl -s "https://get.sdkman.io" | bash; then
|
||||||
|
set +x
|
||||||
|
echo "Error: SDKMAN installation failed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set +x
|
||||||
|
|
||||||
|
# Source SDKMAN to make it available in current session
|
||||||
|
export SDKMAN_DIR="$HOME/.sdkman"
|
||||||
|
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "============================================"
|
||||||
|
# Verify installation
|
||||||
|
if [ -d "$HOME/.sdkman" ] && [ -f "$HOME/.sdkman/bin/sdkman-init.sh" ]; then
|
||||||
|
echo "SDKMAN installed successfully!"
|
||||||
|
echo ""
|
||||||
|
echo "To start using SDKMAN, either:"
|
||||||
|
echo " 1. Restart your shell, or"
|
||||||
|
echo " 2. Run: source ~/.bashrc"
|
||||||
|
echo ""
|
||||||
|
echo "Then you can install Java with:"
|
||||||
|
echo " sdk list java # List available Java versions"
|
||||||
|
echo " sdk install java # Install latest Java"
|
||||||
|
echo " sdk install java 21.0.1-tem # Install specific version"
|
||||||
|
echo ""
|
||||||
|
echo "Other useful SDKMAN commands:"
|
||||||
|
echo " sdk install gradle # Install Gradle"
|
||||||
|
echo " sdk install maven # Install Maven"
|
||||||
|
echo " sdk list # List all available SDKs"
|
||||||
|
else
|
||||||
|
echo "Error: SDKMAN installation verification failed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "============================================"
|
||||||
|
|||||||
@ -1,5 +1,79 @@
|
|||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
#!/bin/bash
|
||||||
sudo rm -rf /opt/nvim
|
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
|
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
||||||
|
|
||||||
export PATH="$PATH:/opt/nvim-linux64/bin"
|
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 "============================================"
|
||||||
|
|||||||
@ -1,12 +1,61 @@
|
|||||||
# Create the file repository configuration:
|
#!/bin/bash
|
||||||
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
set -euo pipefail
|
||||||
|
|
||||||
# Import the repository signing key:
|
echo "============================================"
|
||||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
echo "PostgreSQL Installation Script"
|
||||||
|
echo "============================================"
|
||||||
|
echo ""
|
||||||
|
echo "This script will run the following commands with sudo:"
|
||||||
|
echo " - mkdir -p /etc/apt/keyrings"
|
||||||
|
echo " - curl ... | gpg --dearmor -o /etc/apt/keyrings/postgresql.gpg"
|
||||||
|
echo " - tee /etc/apt/sources.list.d/pgdg.list"
|
||||||
|
echo " - apt-get update"
|
||||||
|
echo " - apt-get install -y postgresql"
|
||||||
|
echo ""
|
||||||
|
read -p "Continue with installation? (y/N) " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
echo "Installation cancelled."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Update the package lists:
|
echo ""
|
||||||
|
echo "Starting installation (commands will be shown as they run)..."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Enable command tracing
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# Create directory for keyrings if it doesn't exist
|
||||||
|
sudo mkdir -p /etc/apt/keyrings
|
||||||
|
|
||||||
|
# Download and install the PostgreSQL GPG key
|
||||||
|
if [ ! -f /etc/apt/keyrings/postgresql.gpg ]; then
|
||||||
|
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
|
||||||
|
sudo gpg --dearmor -o /etc/apt/keyrings/postgresql.gpg
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add PostgreSQL repository
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/pgdg.list > /dev/null
|
||||||
|
|
||||||
|
# Update package lists
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
# Install the latest version of PostgreSQL.
|
# Install latest PostgreSQL
|
||||||
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
|
sudo apt-get install -y postgresql
|
||||||
sudo apt-get -y install postgresql
|
|
||||||
|
# Disable command tracing for cleaner output
|
||||||
|
set +x
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "============================================"
|
||||||
|
# Verify installation
|
||||||
|
if command -v psql &> /dev/null; then
|
||||||
|
echo "PostgreSQL installed successfully!"
|
||||||
|
psql --version
|
||||||
|
else
|
||||||
|
echo "Error: PostgreSQL installation failed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "============================================"
|
||||||
|
|||||||
@ -1,24 +1,83 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# Update the package list
|
echo "============================================"
|
||||||
|
echo "Python 3 Latest Installation Script"
|
||||||
|
echo "============================================"
|
||||||
|
echo ""
|
||||||
|
echo "This script will run the following commands with sudo:"
|
||||||
|
echo " - apt-get update"
|
||||||
|
echo " - apt-get install -y software-properties-common"
|
||||||
|
echo " - add-apt-repository -y ppa:deadsnakes/ppa"
|
||||||
|
echo " - apt-get update"
|
||||||
|
echo " - apt-get install -y python3.X python3.X-venv python3.X-dev python3.X-distutils"
|
||||||
|
echo " - <latest-python> (to install pip via get-pip.py)"
|
||||||
|
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
|
||||||
|
|
||||||
|
# Install prerequisites
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y software-properties-common
|
||||||
|
|
||||||
|
# Add deadsnakes PPA
|
||||||
|
sudo add-apt-repository -y ppa:deadsnakes/ppa
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
# Install the software-properties-common package
|
# Disable tracing temporarily to find latest version cleanly
|
||||||
sudo apt-get install software-properties-common
|
set +x
|
||||||
|
|
||||||
# Add the deadsnakes PPA to the sources list
|
# Find the latest Python 3 version available
|
||||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
echo "Finding latest Python 3 version..."
|
||||||
|
LATEST_PYTHON=$(apt-cache search --names-only '^python3\.[0-9]+$' | \
|
||||||
|
grep -oP 'python3\.\d+' | \
|
||||||
|
sort -V | \
|
||||||
|
tail -1)
|
||||||
|
|
||||||
# Update the package list again
|
if [ -z "$LATEST_PYTHON" ]; then
|
||||||
sudo apt-get update
|
echo "Error: Could not determine latest Python 3 version" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Check the latest version of Python 3 available
|
echo "Installing $LATEST_PYTHON..."
|
||||||
latest_version=$(apt-cache madison python3 | awk '{print $3}' | grep "^3\." | sort -V | tail -1)
|
set -x
|
||||||
|
|
||||||
# Install the latest version of Python 3
|
sudo apt-get install -y \
|
||||||
sudo apt-get install -y python3=$latest_version
|
"$LATEST_PYTHON" \
|
||||||
|
"$LATEST_PYTHON-venv" \
|
||||||
|
"$LATEST_PYTHON-dev" \
|
||||||
|
"$LATEST_PYTHON-distutils"
|
||||||
|
|
||||||
# Verify the installation
|
# Install pip for the new Python version
|
||||||
python3 --version
|
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo "$LATEST_PYTHON"
|
||||||
which python3
|
|
||||||
|
|
||||||
|
# Disable command tracing for cleaner output
|
||||||
|
set +x
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "============================================"
|
||||||
|
# Verify installation
|
||||||
|
if command -v "$LATEST_PYTHON" &> /dev/null; then
|
||||||
|
echo "$LATEST_PYTHON installed successfully!"
|
||||||
|
"$LATEST_PYTHON" --version
|
||||||
|
"$LATEST_PYTHON" -m pip --version
|
||||||
|
else
|
||||||
|
echo "Error: $LATEST_PYTHON installation failed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "Note: Use '$LATEST_PYTHON' to run this version"
|
||||||
|
echo "To make it the default python3, run:"
|
||||||
|
echo " sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/$LATEST_PYTHON 1"
|
||||||
|
echo "============================================"
|
||||||
|
|||||||
@ -1,3 +1,68 @@
|
|||||||
pip3 install visidata
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# https://www.visidata.org/install/
|
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 "============================================"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user