#!/bin/bash # # Download all external dependencies for air-gapped environment # Creates offline package cache for Jenkins/Dockerfile use # # Usage: ./download-all-dependencies.sh [output-directory] # # Output directory structure: # offline-cache/ # ├── qt6/ # Qt6 packages from aqtinstall # ├── src/ # Source tarballs (KDReports, Log4Qt, Grantlee) # ├── deb/ # Ubuntu .deb packages # └── scripts/ # Installation scripts for offline use # set -euo pipefail # Configuration OUTPUT_DIR="${1:-./offline-cache}" QT_VERSION="6.10.2" QT_MODULES="qtmultimedia qtserialport qtimageformats qtwebsockets qtwebengine qtpdf qtwebview qt5compat qtwebchannel qtpositioning qtlocation qtsensors" # Air-gapped environment configuration (from Dockerfiles) NEXUS_REPO="http://remote-repo.sl.defence-elec.de:8081" PIP_INDEX_URL="${NEXUS_REPO}/repository/proxypipy/" APT_SOURCES="${NEXUS_REPO}/repository/ubuntu" echo "=========================================" echo "Downloading External Dependencies" echo "=========================================" echo "Output directory: ${OUTPUT_DIR}" echo "Qt Version: ${QT_VERSION}" echo "=========================================" # Create directory structure mkdir -p "${OUTPUT_DIR}"/{qt6,src,deb,scripts} # Run download in Docker container with proper environment echo "" echo "Running download in Ubuntu 26.04 Docker container..." echo "" docker run --rm \ -v "$(pwd)/${OUTPUT_DIR}:/cache" \ -e PIP_INDEX_URL="${PIP_INDEX_URL}" \ -e NEXUS_REPO="${NEXUS_REPO}" \ ubuntu:26.04 \ bash -c " set -euo pipefail OUTPUT_DIR='/cache' QT_VERSION='${QT_VERSION}' QT_MODULES='${QT_MODULES}' NEXUS_REPO='${NEXUS_REPO}' PIP_INDEX_URL='${PIP_INDEX_URL}' echo '=== Installing required packages ===' apt-get update -qq apt-get install -y -qq python3 python3-venv python3-pip git wget curl apt-transport-https echo '' echo '=== Setting up Python virtual environment for aqtinstall ===' python3 -m venv /tmp/aqtinstall_venv source /tmp/aqtinstall_venv/bin/activate # Install aqtinstall from standard PyPI (not available in internal proxy) echo 'Installing aqtinstall from standard PyPI...' pip install --quiet --index-url https://pypi.org/simple aqtinstall echo '' echo '=== Downloading Qt6 \${QT_VERSION} ===' aqt install-qt linux desktop \${QT_VERSION} linux_gcc_64 \\ --modules \${QT_MODULES} \\ --outputdir /cache/qt6 \\ --base \${NEXUS_REPO}/repository/qt-mirror/ echo '' echo 'Qt6 downloaded to /cache/qt6' echo '' echo '=== Downloading Source Tarballs ===' # KDReports echo 'Downloading KDReports 2.3.0...' git clone --depth 1 --branch kdreports-2.3.0 \\ https://github.com/KDAB/KDReports.git \\ /tmp/KDReports tar -czf /cache/src/KDReports-2.3.0.tar.gz -C /tmp KDReports rm -rf /tmp/KDReports # Log4Qt echo 'Downloading Log4Qt 2.0.0...' git clone --depth 1 --branch v2.0.0 \\ https://github.com/MEONMedical/Log4Qt.git \\ /tmp/Log4Qt tar -czf /cache/src/Log4Qt-2.0.0.tar.gz -C /tmp Log4Qt rm -rf /tmp/Log4Qt # Grantlee echo 'Downloading Grantlee (master branch)...' git clone --depth 1 \\ https://github.com/steveire/grantlee.git \\ /tmp/grantlee GRANTLEE_COMMIT=\$(cd /tmp/grantlee && git rev-parse HEAD) echo 'Grantlee commit: \${GRANTLEE_COMMIT}' tar -czf /cache/src/grantlee-\${GRANTLEE_COMMIT:0:7}.tar.gz -C /tmp grantlee rm -rf /tmp/grantlee echo '' echo 'Source tarballs downloaded to /cache/src' # Cleanup deactivate 2>/dev/null || true rm -rf /tmp/aqtinstall_venv echo '' echo '=== Download Complete ===' "