Files
openvino-runtime-simple-ins…/main.sh
T
stornic56 b042516ee9 feat: subcomando doctor (verificacion post-instalacion)
- core/doctor.sh: run_doctor_checks() — symlink estable, version.txt, clinfo, vainfo, grupos render/video; salida con print_*, exit code = numero de checks con fallo
- clinfo/vainfo con patron captura-then-parse (clinfo tiene salida enorme: grep -q SIGPIPE-mata la pipe y reportaba falso negativo bajo pipefail — verificado en sistema real con plataforma OpenCL detectada)
- main.sh: dispatch del subcomando ANTES del root check (el doctor es verificacion de usuario, sin root) — requiere el reorden routes/source antes de privilegios (resuelve la causa raiz de O2; el cambio cosmico echo->print_error queda para fase siguiente)
2026-09-28 23:55:20 -05:00

207 lines
7.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -euo pipefail
# ------------------------------------------------------------------------------
# OpenVINO Simple Installer – Orquestador
# Detects OS, Intel GPU, installs drivers (NEO), dependencies and the runtime.
# It supports Debian 13, Ubuntu 22.04/24.04/26.04, and Fedora (latest stable versions).
# ------------------------------------------------------------------------------
# routes
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CORE_DIR="$SCRIPT_DIR/core"
MODULES_DIR="$SCRIPT_DIR/modules"
# print
source "$CORE_DIR/common.sh"
# Subcommands (before the root check: doctor is a post-install user verification)
case "${1:-}" in
doctor)
source "$CORE_DIR/doctor.sh"
run_doctor_checks
exit 0
;;
esac
# privileges
if [ "$EUID" -ne 0 ]; then
echo "ERROR: This script must be run as root. Use:"
echo " sudo bash $0"
exit 1
fi
print_step "============================================="
print_step " OpenVINO 2026 - SimpleInstaller"
print_step "============================================="
# ------------------------------------------------------------------------------
# 1. Detect operating system
# ------------------------------------------------------------------------------
print_step "1. Detecting operating system..."
if [ -f /etc/os-release ]; then
. /etc/os-release
OS_ID="$ID"
VERSION_ID="$VERSION_ID"
else
print_error "Could not read /etc/os-release. Unsupported system."
exit 1
fi
print_substep "System detected: $OS_ID $VERSION_ID"
# Prefix mapping
case "$OS_ID" in
debian)
PREFIX="ubuntu24" # Tested and working on Debian 13
;;
ubuntu)
case "$VERSION_ID" in
22.04) PREFIX="ubuntu22" ;;
24.04) PREFIX="ubuntu24" ;;
26.04) PREFIX="ubuntu26" ;;
*)
print_error "Unsupported Ubuntu version: $VERSION_ID"
exit 1
;;
esac
;;
fedora)
PREFIX="rhel8"
;;
*)
print_error "Unsupported distribution: $OS_ID"
exit 1
;;
esac
# ------------------------------------------------------------------------------
# 2. Detect Intel GPU
# ------------------------------------------------------------------------------
print_step "2. Detecting Intel GPU..."
LSPCI_INTEL=$(lspci -nn 2>/dev/null | grep -i "vga\|3d\|display" | grep -i "intel" || true) # lspci missing -> empty -> prompt (documented degradation)
GPU_LINE="${LSPCI_INTEL%%$'\n'*}"
if [ -n "$GPU_LINE" ]; then
GPU_NAME=$(echo "$GPU_LINE" | awk -F': ' '{print $2}')
print_substep "Intel GPU detected: $GPU_NAME"
GPU_PRESENT=true
else
print_warning "No Intel GPU was detected."
GPU_PRESENT=false
read -r -p "Do you want to continue the installation WITHOUT GPU support? [y/n]: " response || {
print_error "No interactive input available (stdin closed). Installation cancelled."
exit 1
}
case "$response" in
[yY]*) ;;
*)
print_error "Installation cancelled by the user."
exit 0
;;
esac
fi
# ------------------------------------------------------------------------------
# 3. Install NEO (only if there is a GPU)
# ------------------------------------------------------------------------------
if [ "$GPU_PRESENT" = true ]; then
print_step "3. Installing GPU drivers (Intel Compute Runtime NEO)..."
case "$OS_ID" in
debian)
bash "$MODULES_DIR/setup_debian.sh"
;;
ubuntu)
bash "$MODULES_DIR/setup_ubuntu.sh"
;;
fedora)
bash "$MODULES_DIR/setup_fedora.sh"
;;
esac
else
print_step "3. Skipping NEO driver installation (no Intel GPU)."
fi
# ------------------------------------------------------------------------------
# 4. Download OpenVINO Runtime
# ------------------------------------------------------------------------------
print_step "4. Downloading OpenVINO Runtime package..."
BASE_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages/2026.4/linux"
VERSION="2026.4.0.22959.99c81491cc3"
FILENAME="openvino_toolkit_${PREFIX}_${VERSION}_x86_64.tgz"
URL="$BASE_URL/$FILENAME"
bash "$CORE_DIR/openvino_logic.sh" "$URL" "$FILENAME"
# ------------------------------------------------------------------------------
# 5. Verify the integrity of the downloaded package
# ------------------------------------------------------------------------------
print_step "5. Integrity verification completed."
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# 6. Extract the tarball and install system dependencies from it (official flow)
# ------------------------------------------------------------------------------
print_step "6. Extracting tarball and installing system dependencies..."
bash "$CORE_DIR/openvino_logic.sh" --extract "$FILENAME"
DEPS_SCRIPT="${FILENAME%.tgz}/install_dependencies/install_openvino_dependencies.sh"
if [ ! -f "$DEPS_SCRIPT" ]; then
print_error "Unexpected tarball layout: install_dependencies/ not found in the extracted folder."
exit 1
fi
print_substep "Installing system dependencies from the tarball..."
bash "$DEPS_SCRIPT" -y
# ------------------------------------------------------------------------------
# 7. Install OpenVINO
# ------------------------------------------------------------------------------
print_step "7. Installing OpenVINO structure in /opt/intel..."
bash "$CORE_DIR/openvino_logic.sh" --install "$FILENAME"
# ------------------------------------------------------------------------------
# Final message
# ------------------------------------------------------------------------------
print_step "Installation completed successfully!"
# installed version
if [ -f "/opt/intel/openvino_2026/runtime/version.txt" ]; then
echo "Version: $(cat /opt/intel/openvino_2026/runtime/version.txt)"
else
echo "Version: could not be determined"
fi
echo ""
echo "To start using OpenVINO run:"
echo " source /opt/intel/openvino_2026/setupvars.sh"
echo ""
echo "----------------------------------------------------------------------"
if [ "$GPU_PRESENT" = true ]; then
echo "IMPORTANT NOTES:"
echo "1. Restart your session (or system) for the group changes (render, video) to take effect and for you to be able to use the GPU."
echo "2. Check the OpenCL status with: clinfo"
echo "3. Check video acceleration: vainfo"
echo "4. Monitor your GPU in real time: nvtop"
echo "----------------------------------------------------------------------"
else
echo "No GPU drivers or diagnostic tools were installed."
echo "You can use OpenVINO in CPU mode only."
echo "----------------------------------------------------------------------"
fi
# note for Debian (backports)
if [ "$OS_ID" = "debian" ]; then
if ! grep -q "trixie-backports" /etc/apt/sources.list /etc/apt/sources.list.d/* 2>/dev/null; then
echo "NOTE ON VERY RECENT HARDWARE (Battlemage):"
echo "If after restarting the GPU is not recognized (clinfo or vainfo do not"
echo "show devices), you might need a more modern kernel."
echo "Run the following commands:"
echo " echo 'deb http://deb.debian.org/debian/ trixie-backports main contrib non-free non-free-firmware' | sudo tee /etc/apt/sources.list.d/backports.list"
echo " sudo apt update"
echo " sudo apt install -t trixie-backports linux-image-amd64 firmware-linux"
echo " sudo reboot"
fi
fi