#!/bin/bash # Verify Offline Cache Integrity # Usage: bash verify-offline-cache.sh [offline-cache-path] set -euo pipefail OFFLINE_CACHE="${1:-./offline-cache}" echo "=== Verifying Offline Cache ===" echo "Path: $OFFLINE_CACHE" echo "" ERRORS=0 # Check Qt installation echo "Checking Qt 6.10.2..." if [ -d "$OFFLINE_CACHE/qt6/6.10.2/gcc_64" ]; then QT_FILES=$(find "$OFFLINE_CACHE/qt6/6.10.2/gcc_64" -type f | wc -l) if [ "$QT_FILES" -ge 12000 ]; then echo "✓ Qt installation complete ($QT_FILES files)" else echo "✗ Qt installation incomplete (expected 12000+, found $QT_FILES)" ERRORS=$((ERRORS + 1)) fi else echo "✗ Qt installation directory missing" ERRORS=$((ERRORS + 1)) fi # Check source tarballs echo "" echo "Checking source tarballs..." for tarball in KDReports-2.3.0.tar.gz Log4Qt-2.0.0.tar.gz grantlee-20d415b.tar.gz; do if [ -f "$OFFLINE_CACHE/src/$tarball" ]; then SIZE=$(du -h "$OFFLINE_CACHE/src/$tarball" | cut -f1) echo "✓ $tarball ($SIZE)" else echo "✗ $tarball missing" ERRORS=$((ERRORS + 1)) fi done # Check .deb packages echo "" echo "Checking Ubuntu .deb packages..." if [ -d "$OFFLINE_CACHE/deb" ]; then DEB_COUNT=$(ls -1 "$OFFLINE_CACHE/deb"/*.deb 2>/dev/null | wc -l) if [ "$DEB_COUNT" -ge 49 ]; then echo "✓ Debian packages complete ($DEB_COUNT packages)" else echo "✗ Debian packages incomplete (expected 49+, found $DEB_COUNT)" ERRORS=$((ERRORS + 1)) fi else echo "✗ Debian packages directory missing" ERRORS=$((ERRORS + 1)) fi # Check package list echo "" echo "Checking package inventory..." if [ -f "$OFFLINE_CACHE/scripts/package-list.txt" ]; then echo "✓ Package list present" else echo "✗ Package list missing" ERRORS=$((ERRORS + 1)) fi # Summary echo "" echo "=== Verification Summary ===" if [ "$ERRORS" -eq 0 ]; then echo "✓ All checks passed" exit 0 else echo "✗ $ERRORS check(s) failed" exit 1 fi