From f4f8dc7883694a2aae984de45a36794465e7100b Mon Sep 17 00:00:00 2001 From: stornic56 <71296607+stornic56@users.noreply.github.com> Date: Wed, 29 Apr 2026 17:41:37 -0500 Subject: [PATCH] upload --- core/common.sh | 9 + core/openvino_logic.sh | 77 ++++++ deps/install_openvino_dependencies.sh | 349 ++++++++++++++++++++++++++ main.sh | 183 ++++++++++++++ modules/setup_debian.sh | 100 ++++++++ modules/setup_fedora.sh | 28 +++ modules/setup_ubuntu.sh | 80 ++++++ 7 files changed, 826 insertions(+) create mode 100644 core/common.sh create mode 100644 core/openvino_logic.sh create mode 100644 deps/install_openvino_dependencies.sh create mode 100644 main.sh create mode 100644 modules/setup_debian.sh create mode 100644 modules/setup_fedora.sh create mode 100644 modules/setup_ubuntu.sh diff --git a/core/common.sh b/core/common.sh new file mode 100644 index 0000000..7e3094b --- /dev/null +++ b/core/common.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# ------------------------------------------------------------------------------ +# Common printing functions for all installer scripts. +# ------------------------------------------------------------------------------ + +print_step() { echo -e "\n\033[1;34m>>>\033[0m \033[1m$1\033[0m"; } +print_substep() { echo -e "\033[1;32m =>\033[0m $1"; } +print_warning() { echo -e "\033[1;33m [AVISO]\033[0m $1"; } +print_error() { echo -e "\033[1;31m [ERROR]\033[0m $1"; } diff --git a/core/openvino_logic.sh b/core/openvino_logic.sh new file mode 100644 index 0000000..0f0a5d4 --- /dev/null +++ b/core/openvino_logic.sh @@ -0,0 +1,77 @@ +#!/bin/bash +set -euo pipefail + +# common functions +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/common.sh" + +if [ $# -lt 2 ]; then + print_error "Usage: $0 | $0 --install " + exit 1 +fi + +if [ "$1" = "--install" ]; then + FILENAME="$2" + if [ ! -f "$FILENAME" ]; then + print_error " $FILENAME could not be found to install." + exit 1 + fi + + # Clean up any previous installation before proceeding + if [ -d "/opt/intel/openvino_2026.0" ]; then + print_warning "An existing OpenVINO installation was found. Removing it..." + rm -rf "/opt/intel/openvino_2026.0" + fi + if [ -L "/opt/intel/openvino_2026" ]; then + rm -f "/opt/intel/openvino_2026" + fi + + print_substep "Unzipping $FILENAME..." + tar -xf "$FILENAME" + + # The name of the extracted folder matches the name of the tarball without the .tgz extension + DIRNAME="${FILENAME%.tgz}" + if [ ! -d "$DIRNAME" ]; then + # guess the real name + DIRNAME=$(tar -tf "$FILENAME" | head -1 | cut -d/ -f1) + fi + print_substep "Moving $DIRNAME a /opt/intel/openvino_2026.0..." + mkdir -p /opt/intel + mv "$DIRNAME" "/opt/intel/openvino_2026.0" + + print_substep "Create symbolic link /opt/intel/openvino_2026..." + ln -sf /opt/intel/openvino_2026.0 /opt/intel/openvino_2026 + exit 0 +fi + +# Download and verification mode +URL="$1" +FILENAME="$2" + +if [ -f "$FILENAME" ]; then + print_warning "The file $FILENAME already exists. The download is skipped." +else + print_substep "Download from $URL ..." + wget -q --show-progress "$URL" -O "$FILENAME" +fi + +# Download checksum if available +SHA_URL="${URL}.sha256" +SHA_FILE="${FILENAME}.sha256" +if wget -q --spider "$SHA_URL" 2>/dev/null; then + print_substep "Downloading SHA256..." + wget -q "$SHA_URL" -O "$SHA_FILE" + EXPECTED=$(awk '{print $1}' "$SHA_FILE") + print_substep "Verifying integrity of $FILENAME..." + ACTUAL=$(sha256sum "$FILENAME" | awk '{print $1}') + if [ "$ACTUAL" != "$EXPECTED" ]; then + print_error "SHA256 verification failed!" + echo " Expected: $EXPECTED" + echo " Obtained: $ACTUAL" + print_error "The file may be corrupt or manipulated." + exit 1 + fi + print_substep "SHA256 verified successfully." +else + print_warning "No .sha256 file was found for $FILENAME. Verification will be skipped." +fi diff --git a/deps/install_openvino_dependencies.sh b/deps/install_openvino_dependencies.sh new file mode 100644 index 0000000..268da71 --- /dev/null +++ b/deps/install_openvino_dependencies.sh @@ -0,0 +1,349 @@ +#!/bin/bash + +# Copyright (C) 2018-2026 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +# Modified by stornic56 (2026) to add support for Debian 13 (Trixie), Ubuntu 26.04, +# and Python 3.13 dependencies. Also ensures dnf is used on Fedora. + +set -e + +#=================================================================================================== +# Option parsing + +all_comp=(core dev gpu python) +os=${os:-auto} + +# public options +interactive=yes +dry= +extra= +print= +comp=() + +# private options +keepcache= +selftest= + +while :; do + case $1 in + -h|-\?|--help) + echo "Options:" + echo " -y non-interactive run (off)" + echo " -n dry-run, assume no (off)" + echo " -c= install component , can be repeated (${all_comp[*]})" + echo " -e add extra repositories (RHEL 7, 8, 9) (off)" + echo " -p print package list and exit (off)" + exit + ;; + -y) interactive= ;; + -n) dry=yes ;; + -c=?*) comp+=("${1#*=}") ;; + -e) extra=yes ;; + -p) print=yes ;; + --selftest) selftest=yes ;; + --keepcache) keepcache=yes ;; + *) break ;; + esac + shift +done + +# No components selected - install default +if [ ${#comp[@]} -eq 0 ]; then + comp=("${all_comp[@]}") +fi + +#=================================================================================================== +# Selftest + +if [ -n "$selftest" ] ; then + for image in centos:7 centos:8 rhel:8 rhel:9.1 \ + almalinux:8.7 amazonlinux:2 \ + fedora:34 fedora:35 fedora:36 fedora:37 fedora:38 \ + opensuse/leap:15.3 \ + raspbian:9 debian:9 ubuntu:18.04 \ + raspbian:10 debian:10 ubuntu:20.04 ubuntu:20.10 ubuntu:21.04 \ + raspbian:11 debian:11 ubuntu:21.10 ubuntu:22.04 \ + raspbian:12 debian:12 debian:13 ubuntu:22.10 ubuntu:23.04 ubuntu:24.04; do + for opt in "-h" "-p" "-e -p" "-n" "-n -e" "-y" "-y -e" ; do + echo "||" + echo "|| Test $image / '$opt'" + echo "||" + SCRIPT_DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE:-$0}")" )" >/dev/null 2>&1 && pwd )" + docker run -it --rm \ + --volume "${SCRIPT_DIR}":/scripts:ro,Z \ + --volume yum-cache:/var/cache/yum \ + --volume apt-cache:/var/cache/apt/archives \ + -e DEBIAN_FRONTEND=noninteractive \ + $image \ + bash "/scripts/${0##*/}" "$opt" --keepcache + echo "||" + echo "|| Completed: $image / '$opt'" + echo "||" + done + done + + for opt in "-h" "-p" "-e -p" "-n" "-n -e" "-y" "-y -e"; do + echo "||" + echo "|| Test ubuntu:26.04 / '$opt'" + echo "||" + SCRIPT_DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE:-$0}")" )" >/dev/null 2>&1 && pwd )" + docker run -it --rm \ + --volume "${SCRIPT_DIR}":/scripts:ro,Z \ + --volume yum-cache:/var/cache/yum \ + --volume apt-cache:/var/cache/apt/archives \ + -e DEBIAN_FRONTEND=noninteractive \ + ubuntu:26.04 \ + bash "/scripts/${0##*/}" "$opt" --keepcache 2>/dev/null || true + echo "||" + echo "|| Completed: ubuntu:26.04 / '$opt'" + echo "||" + done + + echo "Self test finished, to remove temporary docker volumes run:" + echo "'docker volume rm yum-cache apt-cache'" + exit 0 +fi + +#=================================================================================================== +# OS detection + +if [ "$os" == "auto" ] ; then + # shellcheck source=/dev/null + os=$( . /etc/os-release ; echo "${ID}${VERSION_ID}" ) + if [[ "$os" =~ "rhel8".* ]] ; then + os="rhel8" + fi + case $os in + centos7|centos8|centos9|\ + rhel8|rhel9.1|rhel9.2|rhel9.3|rhel9.4|\ + opencloudos8.5|opencloudos8.6|opencloudos8.8|opencloudos9.0|opencloudos9.2|\ + tencentos3.1|tencentos3.2|tencentos3.3|tencentos4.0|tencentos4.2|\ + anolis8.6|anolis8.8|\ + openEuler20.03|openEuler22.03|openEuler23.03|openEuler24.03|\ + almalinux8.7|almalinux8.8|almalinux9.2|almalinux9.3|almalinux9.4|\ + amzn2|amzn2022|amzn2023|\ + ol8.7|ol8.8|ol9.2|ol9.3|ol9.4|\ + rocky8.7|rocky8.8|rocky9.2|rocky9.3|rocky9.4|\ + fedora29|fedora30|fedora31|fedora32|fedora33|fedora34|fedora35|fedora36|\ + fedora37|fedora38|fedora39|fedora40|fedora41|\ + fedora42|fedora43|fedora44|fedora*|\ + opensuse-leap15.3|\ + raspbian9|debian9|ubuntu18.04|\ + raspbian10|debian10|ubuntu20.04|ubuntu20.10|ubuntu21.04|\ + raspbian11|debian11|ubuntu21.10|ubuntu22.04|\ + raspbian12|debian12|debian13|ubuntu22.10|ubuntu23.04|ubuntu23.10|ubuntu24.04|ubuntu26.04) [ -z "$print" ] && echo "Detected OS: ${os}" ;; + *) echo "Unsupported OS: ${os:-detection failed}" >&2 ; exit 1 ;; + esac +fi + +#=================================================================================================== +# Collect packages + +extra_repos=() + +if [ "$os" == "raspbian9" ] || [ "$os" == "debian9" ]; then + pkgs_gpu=(ocl-icd-libopencl1) + pkgs_python=() + pkgs_dev=(pkg-config g++ gcc libc6-dev make sudo) + +elif [ "$os" == "ubuntu18.04" ] ; then + pkgs_gpu=(ocl-icd-libopencl1) + pkgs_python=(python3.8 libpython3.8 python3.8-venv python3-pip) + pkgs_dev=(cmake pkg-config g++ gcc libc6-dev make sudo) + +elif [ "$os" == "ubuntu20.04" ] || [ "$os" == "debian10" ] || [ "$os" == "raspbian10" ] || \ + [ "$os" == "ubuntu21.10" ] || [ "$os" == "ubuntu22.04" ] || [ "$os" == "debian11" ] || [ "$os" == "raspbian11" ] || \ + [ "$os" == "ubuntu22.10" ] || [ "$os" == "ubuntu23.04" ] || [ "$os" == "ubuntu24.04" ] || [ "$os" == "debian12" ] || [ "$os" == "raspbian12" ] || \ + [ "$os" == "debian13" ] || [ "$os" == "ubuntu26.04" ]; then + + pkgs_gpu=(ocl-icd-libopencl1) + pkgs_python=(python3 python3-venv python3-pip) + pkgs_dev=(cmake pkgconf g++ gcc libc6-dev make sudo) + + if [ "$os" == "debian10" ] || [ "$os" == "raspbian10" ]; then + pkgs_python+=(libpython3.7) + elif [ "$os" == "ubuntu20.04" ] || [ "$os" == "ubuntu20.10" ] || [ "$os" == "ubuntu21.04" ]; then + pkgs_python+=(libpython3.8) + elif [ "$os" == "ubuntu21.10" ] || \ + [ "$os" == "debian11" ] || [ "$os" == "raspbian11" ]; then + pkgs_python+=(libpython3.9) + elif [ "$os" == "ubuntu22.04" ] || [ "$os" == "ubuntu22.10" ] || \ + [ "$os" == "debian12" ] || [ "$os" == "raspbian12" ]; then + pkgs_python+=(libpython3.10) + elif [ "$os" == "ubuntu23.04" ]; then + pkgs_python+=(libpython3.11) + elif [ "$os" == "ubuntu24.04" ]; then + pkgs_python+=(libpython3.12) + elif [ "$os" == "debian13" ]; then + pkgs_python+=(libpython3.13) + elif [ "$os" == "ubuntu25.04" ] || [ "$os" == "ubuntu26.04" ]; then + pkgs_python+=(libpython3.14) + fi + +elif [ "$os" == "centos7" ] || [ "$os" == "centos8" ] || [ "$os" == "centos9" ] || + [ "$os" == "rhel8" ] || + [ "$os" == "rhel9.1" ] || [ "$os" == "rhel9.2" ] || [ "$os" == "rhel9.3" ] || [ "$os" == "rhel9.4" ] || + [ "$os" == "opencloudos8.5" ] || [ "$os" == "opencloudos8.6" ] || [ "$os" == "opencloudos8.8" ] || + [ "$os" == "opencloudos9.0" ] || [ "$os" == "opencloudos9.2" ] || + [ "$os" == "tencentos3.1" ] || [ "$os" == "tencentos3.2" ] || [ "$os" == "tencentos3.3" ] || + [ "$os" == "tencentos4.0" ] || [ "$os" == "tencentos4.2" ] || + [ "$os" == "anolis8.6" ] || [ "$os" == "anolis8.8" ] || + [ "$os" == "openEuler20.03" ] || [ "$os" == "openEuler22.03" ] || [ "$os" == "openEuler23.03" ] || [ "$os" == "openEuler24.03" ] || + [ "$os" == "fedora29" ] || [ "$os" == "fedora30" ] || [ "$os" == "fedora31" ] || [ "$os" == "fedora32" ] || + [ "$os" == "fedora33" ] || [ "$os" == "fedora34" ] || [ "$os" == "fedora35" ] || [ "$os" == "fedora36" ] || + [ "$os" == "fedora37" ] || [ "$os" == "fedora38" ] || [ "$os" == "fedora39" ] || [ "$os" == "fedora40" ] || + [ "$os" == "fedora41" ] || [ "$os" == "fedora42" ] || [ "$os" == "fedora43" ] || [ "$os" == "fedora44" ] || [[ "$os" == fedora* ]] || + [ "$os" == "ol8.7" ] || [ "$os" == "ol8.8" ] || + [ "$os" == "ol9.2" ] || [ "$os" == "ol9.3" ] || [ "$os" == "ol9.4" ] || + [ "$os" == "rocky8.7" ] || [ "$os" == "rocky8.8" ] || + [ "$os" == "rocky9.2" ] || [ "$os" == "rocky9.3" ] || [ "$os" == "rocky9.4" ] || + [ "$os" == "almalinux8.7" ] || [ "$os" == "almalinux8.8" ] || + [ "$os" == "almalinux9.2" ] || [ "$os" == "almalinux9.3" ] || [ "$os" == "almalinux9.4" ] || + [ "$os" == "amzn2" ] || [ "$os" == "amzn2022" ] || [ "$os" == "amzn2023" ] ; then + + arch=$(uname -m) + + if [ "$os" == "amzn2" ] ; then + amazon-linux-extras install epel python3.8 + fi + + pkgs_gpu=() + pkgs_python=() + pkgs_dev=(gcc gcc-c++ make glibc libstdc++ libgcc cmake3 sudo) + + if [ "$os" == "centos7" ] || [ "$os" == "amzn2" ] ; then + pkgs_dev+=(pkgconfig) + else + pkgs_dev+=(pkgconf-pkg-config) + fi + + if [ "$os" == "fedora29" ] || [ "$os" == "fedora30" ] || [ "$os" == "fedora31" ] || [ "$os" == "fedora32" ] || + [ "$os" == "fedora33" ] || [ "$os" == "fedora34" ] || [ "$os" == "fedora35" ] || [ "$os" == "fedora36" ] || + [ "$os" == "fedora37" ] || [ "$os" == "fedora38" ] || [ "$os" == "fedora39" ] || [ "$os" == "fedora40" ] || + [ "$os" == "fedora41" ] || [ "$os" == "fedora42" ] || [ "$os" == "fedora43" ] || [ "$os" == "fedora44" ] || [[ "$os" == fedora* ]] || + [ "$os" == "ol8.7" ] || [ "$os" == "ol8.8" ] || + [ "$os" == "ol9.2" ] || [ "$os" == "ol9.3" ] || [ "$os" == "ol9.4" ] || + [ "$os" == "rocky8.7" ] || [ "$os" == "rocky8.8" ] || + [ "$os" == "rocky9.2" ] || [ "$os" == "rocky9.3" ] || [ "$os" == "rocky9.4" ] || + [ "$os" == "almalinux8.7" ] || [ "$os" == "almalinux8.8" ] || + [ "$os" == "almalinux9.2" ] || [ "$os" == "almalinux9.3" ] || [ "$os" == "almalinux9.4" ] || + [ "$os" == "centos8" ] || [ "$os" == "centos9" ] || + [ "$os" == "amzn2022" ] || [ "$os" == "amzn2023" ] || + [ "$os" == "anolis8.6" ] || [ "$os" == "anolis8.8" ] || + [ "$os" == "openEuler20.03" ] || [ "$os" == "openEuler22.03" ] || [ "$os" == "openEuler23.03" ] || [ "$os" == "openEuler24.03" ] ; then + pkgs_python+=(python3 python3-pip) + fi + + if [ "$os" == "centos7" ] || [ "$os" == "amzn2" ] ; then + pkgs_gpu+=("ocl-icd.$arch") + extra_repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm") + elif [ "$os" == "rhel8" ] ; then + pkgs_gpu+=("http://vault.centos.org/centos/8-stream/AppStream/$arch/os/Packages/ocl-icd-2.2.12-1.el8.$arch.rpm") + pkgs_python+=(python38 python38-pip) + extra_repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm") + elif [ "$os" == "rhel9.1" ] || [ "$os" == "rhel9.2" ] || [ "$os" == "rhel9.3" ] || [ "$os" == "rhel9.4" ] ; then + pkgs_gpu+=("https://mirror.stream.centos.org/9-stream/AppStream/$arch/os/Packages/ocl-icd-2.2.13-4.el9.$arch.rpm") + pkgs_python+=(python3 python3-pip) + extra_repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm") + fi +elif [ "$os" == "opensuse-leap15.3" ] ; then + pkgs_gpu=(libOpenCL1) + pkgs_python=(python39-base python39 python39-venv python39-pip) + pkgs_dev=(cmake pkg-config gcc-c++ gcc make sudo) +else + echo "Internal script error: invalid OS (${os}) after check (package selection)" >&2 + exit 3 +fi + +#=================================================================================================== +# Gather packages and print list + +pkgs=() +for comp in "${comp[@]}" ; do + var="pkgs_${comp}[@]" + pkgs+=("${!var}") +done + +if [ ${#pkgs[@]} -eq 0 ]; then + if [ -n "$print" ] ; then + echo "No packages to install" >&2 + exit 1 + else + echo "No packages to install" + exit 0 + fi +fi + +if [ -n "$print" ] ; then + echo "${pkgs[*]}" + exit 0 +fi + +#=================================================================================================== +# Actual installation + +if [ $EUID -ne 0 ]; then + echo "ERROR: this script must be run as root to install 3rd party packages." >&2 + echo "Please try again with \"sudo -E $0\", or as root." >&2 + exit 1 +fi + +iopt= + +if [ "$os" == "debian9" ] || [ "$os" == "raspbian9" ] || [ "$os" == "ubuntu18.04" ] || + [ "$os" == "debian10" ] || [ "$os" == "raspbian10" ] || [ "$os" == "ubuntu20.04" ] || [ "$os" == "ubuntu20.10" ] || [ "$os" == "ubuntu21.04" ] || + [ "$os" == "debian11" ] || [ "$os" == "raspbian11" ] || [ "$os" == "ubuntu21.10" ] || [ "$os" == "ubuntu22.04" ] || + [ "$os" == "debian12" ] || [ "$os" == "raspbian12" ] || [ "$os" == "debian13" ] || [ "$os" == "ubuntu22.10" ] || [ "$os" == "ubuntu23.04" ] || [ "$os" == "ubuntu23.10" ] || [ "$os" == "ubuntu24.04" ] || [ "$os" == "ubuntu26.04" ] ; then + + [ -z "$interactive" ] && iopt="-y" + [ -n "$dry" ] && iopt="--dry-run" + [ -n "$keepcache" ] && rm -f /etc/apt/apt.conf.d/docker-clean + + apt-get update && apt-get install --no-install-recommends "$iopt" "${pkgs[@]}" + +elif [ "$os" == "centos7" ] || [ "$os" == "centos8" ] || [ "$os" == "centos9" ] || + [ "$os" == "rhel8" ] || + [ "$os" == "rhel9.1" ] || [ "$os" == "rhel9.2" ] || [ "$os" == "rhel9.3" ] || [ "$os" == "rhel9.4" ] || + [ "$os" == "anolis8.6" ] || [ "$os" == "anolis8.8" ] || + [ "$os" == "openEuler20.03" ] || [ "$os" == "openEuler22.03" ] || [ "$os" == "openEuler23.03" ] || [ "$os" == "openEuler24.03" ] || + [ "$os" == "fedora29" ] || [ "$os" == "fedora30" ] || [ "$os" == "fedora31" ] || [ "$os" == "fedora32" ] || + [ "$os" == "fedora33" ] || [ "$os" == "fedora34" ] || [ "$os" == "fedora35" ] || [ "$os" == "fedora36" ] || + [ "$os" == "fedora37" ] || [ "$os" == "fedora38" ] || [ "$os" == "fedora39" ] || [ "$os" == "fedora40" ] || + [ "$os" == "fedora41" ] || [ "$os" == "fedora42" ] || [ "$os" == "fedora43" ] || [ "$os" == "fedora44" ] || [[ "$os" == fedora* ]] || + [ "$os" == "ol8.7" ] || [ "$os" == "ol8.8" ] || + [ "$os" == "ol9.2" ] || [ "$os" == "ol9.3" ] || [ "$os" == "ol9.4" ] || + [ "$os" == "rocky8.7" ] || [ "$os" == "rocky8.8" ] || + [ "$os" == "rocky9.2" ] || [ "$os" == "rocky9.3" ] || [ "$os" == "rocky9.4" ] || + [ "$os" == "almalinux8.7" ] || [ "$os" == "almalinux8.8" ] || + [ "$os" == "almalinux9.2" ] || [ "$os" == "almalinux9.3" ] || [ "$os" == "almalinux9.4" ] || + [ "$os" == "amzn2" ] || [ "$os" == "amzn2022" ] || [ "$os" == "amzn2023" ] ; then + + # Usar dnf en Fedora moderna, yum en el resto + if [[ "$os" == fedora* ]]; then + PKGCMD="dnf" + else + PKGCMD="yum" + fi + + [ -z "$interactive" ] && iopt="--assumeyes" + [ -n "$dry" ] && iopt="--downloadonly" + [ -n "$keepcache" ] && iopt="$iopt --setopt=keepcache=1" + [ -n "$extra" ] && [ ${#extra_repos[@]} -ne 0 ] && $PKGCMD localinstall ${iopt:+$iopt} --nogpgcheck "${extra_repos[@]}" + + $PKGCMD install ${iopt:+$iopt} "${pkgs[@]}" + +elif [ "$os" == "opensuse-leap15.3" ] ; then + + [ -z "$interactive" ] && iopt="-y" + [ -n "$dry" ] && iopt="--dry-run" + [ -n "$keepcache" ] && zypper clean --all + + zypper ref && zypper in --auto-agree-with-licenses --no-recommends "$iopt" "${pkgs[@]}" + +else + echo "Internal script error: invalid OS (${os}) after check (package installation)" >&2 + exit 3 +fi + +exit 0 diff --git a/main.sh b/main.sh new file mode 100644 index 0000000..a64e405 --- /dev/null +++ b/main.sh @@ -0,0 +1,183 @@ +#!/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). +# ------------------------------------------------------------------------------ + +# privileges +if [ "$EUID" -ne 0 ]; then + echo "ERROR: This script must be run as root. Use:" + echo " sudo bash $0" + exit 1 +fi + +# routes +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CORE_DIR="$SCRIPT_DIR/core" +MODULES_DIR="$SCRIPT_DIR/modules" +DEPS_DIR="$SCRIPT_DIR/deps" + +# print +source "$CORE_DIR/common.sh" + +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|26.04) PREFIX="ubuntu24" ;; + *) + 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..." + +if GPU_LINE=$(lspci -nn | grep -i "vga\|3d\|display" | grep -i "intel" | head -1); 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 -p "Do you want to continue the installation WITHOUT GPU support? [y/n]: " response + 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; 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.0/linux" +VERSION="2026.0.0.20965.c6d6a13a886" +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. Install system dependencies for OpenVINO +# ------------------------------------------------------------------------------ +print_step "6. Installing system dependencies (Python, cmake, etc.)..." +bash "$DEPS_DIR/install_openvino_dependencies.sh" -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.0/runtime/version.txt" ]; then + echo "Version: $(cat /opt/intel/openvino_2026.0/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; 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 diff --git a/modules/setup_debian.sh b/modules/setup_debian.sh new file mode 100644 index 0000000..3c7c282 --- /dev/null +++ b/modules/setup_debian.sh @@ -0,0 +1,100 @@ +#!/bin/bash +set -euo pipefail +# Ensure it runs as root from the orchestrator + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../core/common.sh" + +print_step "Debian Module – Drivers and Multimedia" + +# ---- Configure sources.list ---- +print_substep "Ensuring non-free components in sources.list..." +SOURCES_FILE="/etc/apt/sources.list" +if [ -f "$SOURCES_FILE" ]; then + sudo sed -i 's/^\(deb.*trixie.*main\)[^#]*/\1 contrib non-free non-free-firmware/' "$SOURCES_FILE" + sudo sed -i 's/^\(deb.*trixie-security.*main\)[^#]*/\1 contrib non-free non-free-firmware/' "$SOURCES_FILE" + sudo sed -i 's/^\(deb.*trixie-updates.*main\)[^#]*/\1 contrib non-free non-free-firmware/' "$SOURCES_FILE" +fi + +if [ -f /etc/apt/sources.list.d/debian.sources ]; then + print_substep "Deleting duplicate DEB822 file..." + rm -f /etc/apt/sources.list.d/debian.sources +fi +apt-get update + +# ---- Multimedia and diagnostic packages ---- +print_substep "Installing graphics and diagnostic packages..." +apt-get install -y \ + python3-numpy libmfx-gen1.2 libvpl2 libegl-mesa0 libegl1-mesa-dev libgbm1 \ + libgl1-mesa-dri libglapi-mesa libgles2-mesa-dev libglx-mesa0 libxatracker2 \ + mesa-va-drivers mesa-vdpau-drivers vainfo clinfo nvtop ocl-icd-libopencl1 + +print_substep "Installing Intel video driver..." +if apt-get install -y intel-media-va-driver-non-free; then + print_substep "Driver non-free installed." +else + print_warning "No non-free version found, trying the free version..." + apt-get install -y intel-media-va-driver +fi + +# ---- Install NEO from GitHub ---- +print_substep "Downloading and installing NEO…" +TEMP_DIR=$(mktemp -d) +cd "$TEMP_DIR" + +# Hashes SHA256 +declare -A NEO_HASHES=( + ["intel-igc-core-2_2.30.1+20950_amd64.deb"]="0a3114a6f74bf6382d5976633c262ff4c392273828424fce04c7185071f8b2ca" + ["intel-igc-opencl-2_2.30.1+20950_amd64.deb"]="9b24a5778af3c4a6bd211a21e7b6860fde9c6869b29c7c4423b5b1a949db13fd" + ["intel-ocloc_26.09.37435.1-0_amd64.deb"]="893185ee9df9656f1350d701bffc240a7ec04021879e0b8ac645dd1db419cd9e" + ["intel-opencl-icd_26.09.37435.1-0_amd64.deb"]="611c758c169a81c91bfc0b089cb6a53949ec2b6aedbf892635a579c529c63e7a" + ["libigdgmm12_22.9.0_amd64.deb"]="9d712f71c18baee076de9961dda71e8089291e1bd0deb5d649ab5ba5de114f97" + ["libze-intel-gpu1_26.09.37435.1-0_amd64.deb"]="9fb35fbccbb5f85a60283803de961398ec8ae7d23bfd07f1f272307f596972c9" +) + +download_and_verify() { + local url="$1" + local filename="$2" + local expected="$3" + wget -q --show-progress "$url" -O "$filename" + actual=$(sha256sum "$filename" | awk '{print $1}') + if [ "$actual" != "$expected" ]; then + print_error "SHA256 mismatch para $filename" + exit 1 + fi +} + +download_and_verify "https://github.com/intel/intel-graphics-compiler/releases/download/v2.30.1/intel-igc-core-2_2.30.1+20950_amd64.deb" \ + "intel-igc-core-2_2.30.1+20950_amd64.deb" "${NEO_HASHES["intel-igc-core-2_2.30.1+20950_amd64.deb"]}" +download_and_verify "https://github.com/intel/intel-graphics-compiler/releases/download/v2.30.1/intel-igc-opencl-2_2.30.1+20950_amd64.deb" \ + "intel-igc-opencl-2_2.30.1+20950_amd64.deb" "${NEO_HASHES["intel-igc-opencl-2_2.30.1+20950_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/intel-ocloc_26.09.37435.1-0_amd64.deb" \ + "intel-ocloc_26.09.37435.1-0_amd64.deb" "${NEO_HASHES["intel-ocloc_26.09.37435.1-0_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/intel-opencl-icd_26.09.37435.1-0_amd64.deb" \ + "intel-opencl-icd_26.09.37435.1-0_amd64.deb" "${NEO_HASHES["intel-opencl-icd_26.09.37435.1-0_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/libigdgmm12_22.9.0_amd64.deb" \ + "libigdgmm12_22.9.0_amd64.deb" "${NEO_HASHES["libigdgmm12_22.9.0_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/libze-intel-gpu1_26.09.37435.1-0_amd64.deb" \ + "libze-intel-gpu1_26.09.37435.1-0_amd64.deb" "${NEO_HASHES["libze-intel-gpu1_26.09.37435.1-0_amd64.deb"]}" + +print_substep "Instalando paquetes deb..." +dpkg -i libigdgmm12_22.9.0_amd64.deb +dpkg -i intel-igc-core-2_2.30.1+20950_amd64.deb +dpkg -i intel-igc-opencl-2_2.30.1+20950_amd64.deb +dpkg -i intel-ocloc_26.09.37435.1-0_amd64.deb +dpkg -i libze-intel-gpu1_26.09.37435.1-0_amd64.deb +dpkg -i intel-opencl-icd_26.09.37435.1-0_amd64.deb +apt-get install -f -y + +cd / +rm -rf "$TEMP_DIR" + +# ---- Add user to groups ---- +print_substep "Adding user to render and video groups..." +if [ -n "${SUDO_USER:-}" ]; then + usermod -a -G render,video "$SUDO_USER" +else + # root + current_user=$(logname 2>/dev/null || echo "$USER") + usermod -a -G render,video "$current_user" +fi diff --git a/modules/setup_fedora.sh b/modules/setup_fedora.sh new file mode 100644 index 0000000..274c0fc --- /dev/null +++ b/modules/setup_fedora.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../core/common.sh" + +print_step "Fedora Module – Drivers and Multimedia" + +# ---- 1. Instalar NEO completo y herramientas ---- +print_substep "Installing Intel Compute Runtime (NEO)" +dnf install -y intel-compute-runtime clinfo vainfo nvtop + +# ---- 2. Driver multimedia Intel ---- +print_substep "Installing VAAPI Intel driver..." +dnf install -y libva-intel-media-driver + +# ---- 3. Paquetes adicionales (VPL, GBM) ---- +print_substep "Installing libvpl and mesa-libgbm..." +dnf install -y libvpl mesa-libgbm + +# ---- 4. Añadir usuario a grupos ---- +print_substep "Adding user to render and video groups (if they exist)..." +if [ -n "${SUDO_USER:-}" ]; then + usermod -a -G render,video "$SUDO_USER" +else + current_user=$(logname 2>/dev/null || echo "$USER") + usermod -a -G render,video "$current_user" +fi diff --git a/modules/setup_ubuntu.sh b/modules/setup_ubuntu.sh new file mode 100644 index 0000000..b6e694a --- /dev/null +++ b/modules/setup_ubuntu.sh @@ -0,0 +1,80 @@ +#!/bin/bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../core/common.sh" + +print_step "Ubuntu Module – Drivers and Multimedia" + +# ---- 1. Actualizar repositorios ---- +print_substep "Updating package list..." +apt-get update + +# ---- 2. Paquetes multimedia y diagnóstico ---- +print_substep "Installing graphics and diagnostic packages..." +apt-get install -y \ + python3-numpy libmfx-gen1.2 libvpl2 libegl-mesa0 libegl1-mesa-dev libgbm1 \ + libgl1-mesa-dri libglapi-mesa libgles2-mesa-dev libglx-mesa0 libxatracker2 \ + mesa-va-drivers mesa-vdpau-drivers vainfo clinfo nvtop ocl-icd-libopencl1 + +print_substep "Installing Intel non-free video driver..." +apt-get install -y intel-media-va-driver-non-free + +# ---- 3. Install NEO ---- +print_substep "Downloading and installing NEO…" +TEMP_DIR=$(mktemp -d) +cd "$TEMP_DIR" + +declare -A NEO_HASHES=( + ["intel-igc-core-2_2.30.1+20950_amd64.deb"]="0a3114a6f74bf6382d5976633c262ff4c392273828424fce04c7185071f8b2ca" + ["intel-igc-opencl-2_2.30.1+20950_amd64.deb"]="9b24a5778af3c4a6bd211a21e7b6860fde9c6869b29c7c4423b5b1a949db13fd" + ["intel-ocloc_26.09.37435.1-0_amd64.deb"]="893185ee9df9656f1350d701bffc240a7ec04021879e0b8ac645dd1db419cd9e" + ["intel-opencl-icd_26.09.37435.1-0_amd64.deb"]="611c758c169a81c91bfc0b089cb6a53949ec2b6aedbf892635a579c529c63e7a" + ["libigdgmm12_22.9.0_amd64.deb"]="9d712f71c18baee076de9961dda71e8089291e1bd0deb5d649ab5ba5de114f97" + ["libze-intel-gpu1_26.09.37435.1-0_amd64.deb"]="9fb35fbccbb5f85a60283803de961398ec8ae7d23bfd07f1f272307f596972c9" +) + +download_and_verify() { + local url="$1" + local filename="$2" + local expected="$3" + wget -q --show-progress "$url" -O "$filename" + actual=$(sha256sum "$filename" | awk '{print $1}') + if [ "$actual" != "$expected" ]; then + print_error "SHA256 mismatch para $filename" + exit 1 + fi +} + +download_and_verify "https://github.com/intel/intel-graphics-compiler/releases/download/v2.30.1/intel-igc-core-2_2.30.1+20950_amd64.deb" \ + "intel-igc-core-2_2.30.1+20950_amd64.deb" "${NEO_HASHES["intel-igc-core-2_2.30.1+20950_amd64.deb"]}" +download_and_verify "https://github.com/intel/intel-graphics-compiler/releases/download/v2.30.1/intel-igc-opencl-2_2.30.1+20950_amd64.deb" \ + "intel-igc-opencl-2_2.30.1+20950_amd64.deb" "${NEO_HASHES["intel-igc-opencl-2_2.30.1+20950_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/intel-ocloc_26.09.37435.1-0_amd64.deb" \ + "intel-ocloc_26.09.37435.1-0_amd64.deb" "${NEO_HASHES["intel-ocloc_26.09.37435.1-0_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/intel-opencl-icd_26.09.37435.1-0_amd64.deb" \ + "intel-opencl-icd_26.09.37435.1-0_amd64.deb" "${NEO_HASHES["intel-opencl-icd_26.09.37435.1-0_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/libigdgmm12_22.9.0_amd64.deb" \ + "libigdgmm12_22.9.0_amd64.deb" "${NEO_HASHES["libigdgmm12_22.9.0_amd64.deb"]}" +download_and_verify "https://github.com/intel/compute-runtime/releases/download/26.09.37435.1/libze-intel-gpu1_26.09.37435.1-0_amd64.deb" \ + "libze-intel-gpu1_26.09.37435.1-0_amd64.deb" "${NEO_HASHES["libze-intel-gpu1_26.09.37435.1-0_amd64.deb"]}" + +dpkg -i libigdgmm12_22.9.0_amd64.deb +dpkg -i intel-igc-core-2_2.30.1+20950_amd64.deb +dpkg -i intel-igc-opencl-2_2.30.1+20950_amd64.deb +dpkg -i intel-ocloc_26.09.37435.1-0_amd64.deb +dpkg -i libze-intel-gpu1_26.09.37435.1-0_amd64.deb +dpkg -i intel-opencl-icd_26.09.37435.1-0_amd64.deb +apt-get install -f -y + +cd / +rm -rf "$TEMP_DIR" + +# ---- 4. add user ---- +print_substep "Añadiendo usuario a grupos render y video..." +if [ -n "${SUDO_USER:-}" ]; then + usermod -a -G render,video "$SUDO_USER" +else + current_user=$(logname 2>/dev/null || echo "$USER") + usermod -a -G render,video "$current_user" +fi