| # Reconstruct the 5 byte-identical Core ML .mlpackage fixtures from one shared | |
| # seed plus per-variant Manifest.json files. | |
| # | |
| # The ONLY difference between the variants is Manifest.json (specifically the | |
| # rootModelIdentifier value). model.mlmodel and the weights are identical across | |
| # all five variants, so they are shipped once as seed.mlpackage.zip instead of | |
| # being duplicated 5x. This script unpacks the seed and rebuilds the exact same | |
| # packages used in the report (verified byte-identical). | |
| set -euo pipefail | |
| HERE="$(cd "$(dirname "$0")" && pwd)" | |
| OUT="${1:-$HERE/models}" | |
| mkdir -p "$OUT" | |
| # Unpack the shared seed once into the output area (keeps the repo itself clean). | |
| SEEDROOT="$OUT/_seed" | |
| if [ ! -d "$SEEDROOT/seed.mlpackage" ]; then | |
| rm -rf "$SEEDROOT" | |
| mkdir -p "$SEEDROOT" | |
| unzip -q "$HERE/seed.mlpackage.zip" -d "$SEEDROOT" | |
| fi | |
| SEED="$SEEDROOT/seed.mlpackage" | |
| for v in baseline root_id_missing root_id_empty root_key_absent root_points_to_weights; do | |
| rm -rf "$OUT/$v.mlpackage" | |
| cp -R "$SEED" "$OUT/$v.mlpackage" | |
| cp "$HERE/manifest-$v.json" "$OUT/$v.mlpackage/Manifest.json" | |
| done | |
| echo "Reconstructed 5 .mlpackage fixtures in: $OUT" | |