fix(install): pin Playwright host-platform on Ubuntu >24.04
Ubuntu 26.04 (and any release newer than 24.04) isn't in Playwright 1.58.2's supported-build list, so gstack's ./setup aborted with "Playwright does not support chromium on ubuntu26.04-x64". Add gated helper playwright_platform_override() (ubuntu >24.04 → echoes ubuntu24.04-<arch>, else nothing). Export PLAYWRIGHT_HOST_PLATFORM_OVERRIDE before gstack ./setup (install-time download) and persist it to the shell profile (runtime browser launch). Playwright then pulls a compatible Chrome-for-Testing fallback build instead of erroring. Verified on Ubuntu 26.04: override emitted correctly (no var leak), CfT build resolves all shared libs (ldd) and renders headless. No submodule edits — purely an env pin from the wrapper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyNYwD4UccVw9ZCFZyJX55
This commit is contained in:
parent
b6cc8b1a86
commit
211c7d4594
@ -203,6 +203,27 @@ fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Playwright (used by gstack's browser) hardcodes a list of supported Linux
|
||||
# builds (ubuntu20.04/22.04/24.04). On a newer Ubuntu it aborts with
|
||||
# "Playwright does not support chromium on ubuntuXX.04-x64". Pinning the host
|
||||
# platform to the latest supported build makes it download a compatible
|
||||
# Chrome-for-Testing binary instead. Echoes the override value, or nothing
|
||||
# when the running distro is natively supported.
|
||||
playwright_platform_override() {
|
||||
[ -r /etc/os-release ] || return 0
|
||||
local ID="" VERSION_ID="" arch # shadow globals so sourcing can't leak
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/os-release 2>/dev/null
|
||||
[ "${ID:-}" = "ubuntu" ] && [ -n "${VERSION_ID:-}" ] || return 0
|
||||
# Only when newer than 24.04 (the latest build Playwright 1.58 ships).
|
||||
[ "$(printf '%s\n24.04\n' "$VERSION_ID" | sort -V | tail -1)" != "24.04" ] || return 0
|
||||
case "$(uname -m)" in
|
||||
aarch64|arm64) arch="arm64" ;;
|
||||
*) arch="x64" ;;
|
||||
esac
|
||||
printf 'ubuntu24.04-%s' "$arch"
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# STEP 2 — GSTACK SUBMODULE
|
||||
# ============================================================
|
||||
@ -246,6 +267,14 @@ if [ -d "$GSTACK_DIR" ]; then
|
||||
ok "bun $(bun --version)"
|
||||
fi
|
||||
|
||||
# Pin Playwright's host platform on Ubuntu newer than 24.04 so gstack's
|
||||
# ./setup can download a working Chromium (exported into its subshell).
|
||||
PW_OVERRIDE="$(playwright_platform_override)"
|
||||
if [ -n "$PW_OVERRIDE" ]; then
|
||||
export PLAYWRIGHT_HOST_PLATFORM_OVERRIDE="$PW_OVERRIDE"
|
||||
info "Newer Ubuntu detected — pinning Playwright to $PW_OVERRIDE (browser fallback build)"
|
||||
fi
|
||||
|
||||
info "Running GStack setup..."
|
||||
if [ -x "$GSTACK_DIR/setup" ]; then
|
||||
if (cd "$GSTACK_DIR" && ./setup); then
|
||||
@ -646,6 +675,13 @@ CLAUDE_LINES=(
|
||||
'export CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1'
|
||||
)
|
||||
|
||||
# On Ubuntu newer than what Playwright supports, persist the host-platform
|
||||
# override so gstack's browser launches at runtime (not just at install).
|
||||
PW_OVERRIDE="$(playwright_platform_override)"
|
||||
if [ -n "$PW_OVERRIDE" ]; then
|
||||
CLAUDE_LINES+=("export PLAYWRIGHT_HOST_PLATFORM_OVERRIDE=$PW_OVERRIDE")
|
||||
fi
|
||||
|
||||
# Clean up old CLAUDE_EFFORT env var if present (replaced by alias)
|
||||
if grep -qF 'export CLAUDE_EFFORT=max' "$SHELL_PROFILE" 2>/dev/null; then
|
||||
sed -i '/export CLAUDE_EFFORT=max/d' "$SHELL_PROFILE"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user