#!/bin/bash # lib/steps/preflight.sh — verificaciones previas step_preflight() { print_section "Pre-flight" log_step "System checks" 1 $TOTAL_STEPS _preflight_user _preflight_python _preflight_git } _preflight_user() { log_info "Running as: ${USER} (uid=$(id -u))" if [ "$(id -u)" -eq 0 ]; then log_error "No correr el installer como root" exit 1 fi log_ok "User OK" } _preflight_python() { local found="" for candidate in python3.12 python3.13; do if command -v "$candidate" &>/dev/null; then found="$candidate" break fi done if [ -z "$found" ]; then log_error "Se necesita Python 3.12 o 3.13" log_info "Arch: sudo pacman -S python312" log_info "Ubuntu: sudo apt install python3.12" exit 1 fi PYTHON_BIN="$found" log_ok "Python: $($PYTHON_BIN --version 2>&1)" } _preflight_git() { if ! command -v git &>/dev/null; then log_error "git no encontrado" exit 1 fi log_ok "git: $(git --version)" }