#!/usr/bin/env bash set -euo pipefail UMM_ROOT="${UMM_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" cd "${UMM_ROOT}" unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY all_proxy ALL_PROXY ENV_PREFIX="${UMM_ENV_PREFIX:-${UMM_ROOT}/.env/unvideo}" if [[ ! -x "${ENV_PREFIX}/bin/python" ]]; then mkdir -p "${ENV_PREFIX}" tar -xzf "${UMM_ROOT}/environment/unvideo-conda.tar.gz" -C "${ENV_PREFIX}" if [[ -x "${ENV_PREFIX}/bin/conda-unpack" ]]; then "${ENV_PREFIX}/bin/conda-unpack" fi fi PYTHON_BIN="${ENV_PREFIX}/bin/python" "${PYTHON_BIN}" -m pip install --no-deps --no-build-isolation \ -e "${UMM_ROOT}/third_party/transformers" \ -e "${UMM_ROOT}/third_party/diffusers" "${PYTHON_BIN}" "${UMM_ROOT}/scripts/render_config.py" mkdir -p "${UMM_ROOT}/data/covt/images" expected_images="$("${PYTHON_BIN}" -c 'import json; print(json.load(open("data/covt/stats.json"))["image_count"])')" current_images="$(find "${UMM_ROOT}/data/covt/images" -maxdepth 1 -type f | wc -l)" if [[ "${current_images}" != "${expected_images}" ]]; then if [[ "${current_images}" != "0" ]]; then echo "Partial image extraction detected (${current_images}/${expected_images}); rerun with an empty data/covt/images directory." >&2 exit 1 fi for shard in "${UMM_ROOT}"/data/covt/shards/images-*.tar; do ( cd "${UMM_ROOT}/data/covt/shards" sha256sum -c "$(basename "${shard}").sha256" ) tar -xf "${shard}" -C "${UMM_ROOT}/data/covt/images" done fi "${PYTHON_BIN}" "${UMM_ROOT}/scripts/verify_bundle.py" --materialized echo "UMM Stage-2 deployment ready at ${UMM_ROOT}"