From 604e7d60f0d5bfc5f133b977500bc4ae8a3f7097 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 9 Apr 2026 02:33:32 +0000 Subject: [PATCH] Fix offline bundle verification --- offline/downloads/magisk.version | 2 +- verify_offline_bundle.py | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/offline/downloads/magisk.version b/offline/downloads/magisk.version index e324bfb..af025c3 100644 --- a/offline/downloads/magisk.version +++ b/offline/downloads/magisk.version @@ -1 +1 @@ -b149cd26 +b149cd26 diff --git a/verify_offline_bundle.py b/verify_offline_bundle.py index 41d0efa..5b17d6e 100644 --- a/verify_offline_bundle.py +++ b/verify_offline_bundle.py @@ -2,12 +2,15 @@ import hashlib import json +import shutil +import subprocess from pathlib import Path import sys ROOT = Path(__file__).resolve().parent MANIFEST = ROOT / "offline" / "manifest.json" +BASE_IMAGE = "redroid/redroid:13.0.0-latest" def digest(path, algorithm): @@ -18,12 +21,42 @@ def digest(path, algorithm): return hasher.hexdigest() +def runtime_available(runtime): + return shutil.which(runtime) is not None + + +def local_base_image_present(): + for runtime in ("docker", "podman"): + if not runtime_available(runtime): + continue + result = subprocess.run( + [runtime, "image", "inspect", BASE_IMAGE], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + check=False, + ) + if result.returncode == 0: + return True, runtime + return False, "" + + def main(): manifest = json.loads(MANIFEST.read_text(encoding="utf-8")) failures = [] + base_image_present, base_runtime = local_base_image_present() for entry in manifest["artifacts"]: path = ROOT / entry["relative_path"] + if path.name == "redroid-redroid-13.0.0-latest.tar" and base_image_present: + print("SKIP {} ({} already present locally)".format(entry["relative_path"], BASE_IMAGE)) + continue if not path.is_file(): + if path.name == "redroid-redroid-13.0.0-latest.tar": + failures.append( + "{} missing (and {} not found in local {} storage)".format( + entry["relative_path"], BASE_IMAGE, base_runtime or "docker/podman" + ) + ) + continue failures.append("{} missing".format(entry["relative_path"])) continue if path.stat().st_size != entry["size"]: