| # curl -fsSL "https://huggingface.co/datasets/datamatters24/scriptwriter-runpod/resolve/main/go.sh" | bash | |
| set -euo pipefail | |
| REPO="${RUNPOD_BUNDLE_REPO:-datamatters24/scriptwriter-runpod}" | |
| BASE="https://huggingface.co/datasets/${REPO}/resolve/main" | |
| DEST="${WORKDIR:-/workspace/scriptwriter-runpod}" | |
| TGZ="/tmp/scriptwriter-runpod-ready.tgz" | |
| echo "=== Downloading RunPod bundle from ${REPO} ===" | |
| mkdir -p "$(dirname "$DEST")" | |
| # Public repo — no auth needed for the bundle. HF_TOKEN still used later for private dataset/model. | |
| curl -fsSL "${BASE}/scriptwriter-runpod-ready.tgz" -o "${TGZ}" | |
| rm -rf "${DEST}" | |
| mkdir -p "${DEST}" | |
| # RunPod containers cannot chown to uid 1000 — ignore ownership from the tarball | |
| tar xzf "${TGZ}" -C "${DEST}" --strip-components=1 --no-same-owner --no-same-permissions | |
| if [[ ! -f "${DEST}/run.sh" ]]; then | |
| if [[ -f "${DEST}/runpod-ready/run.sh" ]]; then | |
| DEST="${DEST}/runpod-ready" | |
| else | |
| echo "ERROR: run.sh not found after extract" | |
| find "${DEST}" | head -40 | |
| exit 1 | |
| fi | |
| fi | |
| echo "=== Bundle ready at ${DEST} ===" | |
| cd "${DEST}" | |
| export WORKDIR="${DEST}" | |
| bash "${DEST}/run.sh" | |