File size: 1,137 Bytes
fd393b4
afc76d2
fd393b4
 
 
 
 
 
 
 
 
afc76d2
 
fd393b4
 
 
afc76d2
 
fd393b4
 
 
 
 
afc76d2
 
 
fd393b4
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# 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"