chore: allow install e2e previous override

This commit is contained in:
Peter Steinberger
2026-01-14 00:38:26 +00:00
parent 93fbd103ba
commit 571f8c78bd
2 changed files with 16 additions and 4 deletions

View File

@@ -3,6 +3,8 @@ set -euo pipefail
INSTALL_URL="${CLAWDBOT_INSTALL_URL:-https://clawd.bot/install.sh}"
MODELS_MODE="${CLAWDBOT_E2E_MODELS:-both}" # both|openai|anthropic
E2E_PREVIOUS_VERSION="${CLAWDBOT_INSTALL_E2E_PREVIOUS:-}"
SKIP_PREVIOUS="${CLAWDBOT_INSTALL_E2E_SKIP_PREVIOUS:-0}"
if [[ "$MODELS_MODE" != "both" && "$MODELS_MODE" != "openai" && "$MODELS_MODE" != "anthropic" ]]; then
echo "ERROR: CLAWDBOT_E2E_MODELS must be one of: both|openai|anthropic" >&2
@@ -24,17 +26,25 @@ fi
echo "==> Resolve npm versions"
LATEST_VERSION="$(npm view clawdbot version)"
PREVIOUS_VERSION="$(node - <<'NODE'
if [[ -n "$E2E_PREVIOUS_VERSION" ]]; then
PREVIOUS_VERSION="$E2E_PREVIOUS_VERSION"
else
PREVIOUS_VERSION="$(node - <<'NODE'
const { execSync } = require("node:child_process");
const versions = JSON.parse(execSync("npm view clawdbot versions --json", { encoding: "utf8" }));
if (!Array.isArray(versions) || versions.length === 0) process.exit(1);
process.stdout.write(versions.length >= 2 ? versions[versions.length - 2] : versions[0]);
NODE
)"
)"
fi
echo "latest=$LATEST_VERSION previous=$PREVIOUS_VERSION"
echo "==> Preinstall previous (forces installer upgrade path; avoids read() prompt)"
npm install -g "clawdbot@${PREVIOUS_VERSION}"
if [[ "$SKIP_PREVIOUS" == "1" ]]; then
echo "==> Skip preinstall previous (CLAWDBOT_INSTALL_E2E_SKIP_PREVIOUS=1)"
else
echo "==> Preinstall previous (forces installer upgrade path; avoids read() prompt)"
npm install -g "clawdbot@${PREVIOUS_VERSION}"
fi
echo "==> Run official installer one-liner"
curl -fsSL "$INSTALL_URL" | bash