deploy/cloudflare-iso-builder/scripts/embed-build-iso.py
back to source
#!/usr/bin/env python3
"""Regenerate src/build-iso-script.ts from scripts/build-iso.sh."""
from __future__ import annotations
import json
from pathlib import Path
root = Path(__file__).resolve().parents[1]
sh_path = root / "scripts" / "build-iso.sh"
out_path = root / "src" / "build-iso-script.ts"
sh = sh_path.read_text(encoding="utf-8").replace("\r\n", "\n")
if "default=0" not in sh or "console=ttyS0,115200n8" not in sh:
raise SystemExit("build-iso.sh missing expected serial GRUB defaults")
out_path.write_text(
"// Auto-generated from scripts/build-iso.sh — do not edit by hand.\n"
f"export const BUILD_ISO_SH = {json.dumps(sh)};\n",
encoding="utf-8",
)
print(f"wrote {out_path} ({len(sh)} script bytes)")