#!/bin/bash # ============================================================================== # DEPRECATED: pi_init.sh # ============================================================================== # ⚠️ DEPRECATION NOTICE # This script is deprecated and will be removed in a future release. # Please use the unified bootstrap.sh script instead: # # ./bootstrap.sh --hardware-type pi # # This wrapper will redirect to bootstrap.sh with appropriate flags. # ============================================================================== set -euo pipefail # Show deprecation warning echo "=======================================" >&2 echo "⚠️ DEPRECATION WARNING" >&2 echo "=======================================" >&2 echo "pi_init.sh is deprecated!" >&2 echo "" >&2 echo "Please use: ./bootstrap.sh" >&2 echo "" >&2 echo "Redirecting to bootstrap.sh in 5 seconds..." >&2 echo "Press Ctrl+C to cancel" >&2 echo "=======================================" >&2 sleep 5 # Redirect to unified bootstrap SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" exec "${SCRIPT_DIR}/bootstrap.sh" --hardware-type pi "$@" # ============================================================================== # LEGACY CODE BELOW (no longer executed) # ============================================================================== exit 0 #!/bin/bash # ============================================================================== # SINGLE-COMMAND BOOTSTRAP: IP, DOCKER, ANSIBLE # Target: Ubuntu / Debian # ============================================================================== set -euo pipefail # --- 1. SET STATIC IP (Netplan) --- echo "[⚙] Configuring Static IP to 10.0.0.200..." # Find the active physical interface (e.g., eth0, enp3s0) INTERFACE=$(ip -o link show | awk -F': ' '$2 != "lo" {print $2}' | head -n1) sudo mkdir -p /etc/netplan sudo cat < /etc/netplan/01-netcfg.yaml network: version: 2 renderer: networkd ethernets: $INTERFACE: addresses: - 10.0.0.200/24 nameservers: addresses: [10.0.0.2, 8.8.8.8] routes: - to: default via: 10.0.0.1 EOF echo "[✓] Netplan config created. Applying in background..." # We apply in background so the script doesn't hang if SSH drops sudo netplan apply & # --- 2. INSTALL DOCKER --- echo "[⚙] Installing Docker..." sudo apt-get update -qq sudo apt-get install -y ca-certificates curl gnupg lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg --yes echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update -qq sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin # Allow current user to run docker without sudo sudo usermod -aG docker $USER echo "[✓] Docker installed." # --- 3. INSTALL ANSIBLE --- echo "[⚙] Installing Ansible..." sudo apt-get install -y software-properties-common sudo add-apt-repository --yes --update ppa:ansible/ansible sudo apt-get install -y ansible echo "[✓] Ansible installed." echo "==========================================" echo "BOOTSTRAP COMPLETE" echo "IP: 10.0.0.200 (You may need to reconnect)" echo "Docker & Ansible: Ready" echo "=========================================="