has issues
This commit is contained in:
parent
2e112d7398
commit
c645b0f1d4
96 changed files with 2147083 additions and 5787 deletions
|
|
@ -107,6 +107,17 @@ done
|
|||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# -- scratch space ------------------------------------------------------------
|
||||
# Host /tmp is a small tmpfs (often <512MB) and /dev/shm is even smaller, but
|
||||
# Playwright spawns a fresh Chromium user-data dir per launch (GPU shader
|
||||
# cache, blob storage, …) and ffmpeg/uv also fall back to TMPDIR for their
|
||||
# intermediates. Steer everything to a local scratch dir under video/ so the
|
||||
# render survives on hosts with a tight /tmp budget. Override SCRATCH_DIR to
|
||||
# point elsewhere if disk under video/ is also constrained.
|
||||
SCRATCH_DIR="${SCRATCH_DIR:-$PWD/.tmp}"
|
||||
mkdir -p "$SCRATCH_DIR"
|
||||
export TMPDIR="$SCRATCH_DIR"
|
||||
|
||||
# -- helpers ------------------------------------------------------------------
|
||||
say() { printf '\n[render] %s\n' "$*"; }
|
||||
fail() { printf '\n[render] FAIL: %s\n' "$*" >&2; exit 1; }
|
||||
|
|
@ -152,12 +163,27 @@ if [ ! -d node_modules ]; then
|
|||
npm install --no-audit --no-fund
|
||||
fi
|
||||
|
||||
# Chromium binary lives in Playwright's cache; install if missing.
|
||||
# Chromium binaries live in Playwright's cache; install if missing.
|
||||
# Playwright launches via chrome-headless-shell by default, so we must verify
|
||||
# BOTH the chromium and chrome-headless-shell executables exist. Checking the
|
||||
# actual binary (not just the parent dir) is intentional: a previously failed
|
||||
# install (e.g. ENOSPC mid-download) leaves the chromium-* / chromium_headless_shell-*
|
||||
# dir in place but without the binary inside, and a dir-only check would
|
||||
# treat that as "installed".
|
||||
chromium_bin="$(find "$HOME/.cache/ms-playwright" -path '*/chromium-*/chrome-linux/chrome' -print -quit 2>/dev/null || true)"
|
||||
headless_shell_bin="$(find "$HOME/.cache/ms-playwright" -path '*/chromium_headless_shell-*/chrome-headless-shell-linux64/chrome-headless-shell' -print -quit 2>/dev/null || true)"
|
||||
if ! npx --no-install playwright --version >/dev/null 2>&1 \
|
||||
|| [ ! -d "$HOME/.cache/ms-playwright" ] \
|
||||
|| ! find "$HOME/.cache/ms-playwright" -maxdepth 1 -name "chromium-*" -print -quit | grep -q .; then
|
||||
|| [ ! -x "${chromium_bin:-/nonexistent}" ] \
|
||||
|| [ ! -x "${headless_shell_bin:-/nonexistent}" ]; then
|
||||
say "Installing Playwright Chromium"
|
||||
npx playwright install chromium
|
||||
# Playwright stages the ~170MB browser zip in $TMPDIR before extracting into
|
||||
# ~/.cache/ms-playwright. /tmp is often a small tmpfs (we've hit ENOSPC at
|
||||
# 92%), so steer the staging dir into the cache dir itself, which lives on
|
||||
# the same (larger) filesystem we're extracting into anyway.
|
||||
pw_tmpdir="$HOME/.cache/ms-playwright/.tmp"
|
||||
mkdir -p "$pw_tmpdir"
|
||||
TMPDIR="$pw_tmpdir" npx playwright install chromium
|
||||
rm -rf "$pw_tmpdir"
|
||||
fi
|
||||
|
||||
# System libs Chromium dlopens (libnspr4, libnss3, libasound2…). Detect via
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue