mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(update): reject openclaw source package targets
This commit is contained in:
+26
-3
@@ -1047,7 +1047,7 @@ Options:
|
||||
--install-method, --method npm|git Install via npm (default) or from a git checkout
|
||||
--npm Shortcut for --install-method npm
|
||||
--git, --github Shortcut for --install-method git
|
||||
--version <version|dist-tag|spec> npm install target (default: latest; use "main" for GitHub main)
|
||||
--version <version|dist-tag|spec> npm install target (default: latest)
|
||||
--beta Use beta if available, else latest
|
||||
--git-dir, --dir <path> Checkout directory (default: ~/openclaw)
|
||||
--no-git-update Skip git pull for existing checkout
|
||||
@@ -1060,7 +1060,7 @@ Options:
|
||||
|
||||
Environment variables:
|
||||
OPENCLAW_INSTALL_METHOD=git|npm
|
||||
OPENCLAW_VERSION=latest|next|main|<semver>|<spec>
|
||||
OPENCLAW_VERSION=latest|next|<semver>|<spec>
|
||||
OPENCLAW_BETA=0|1
|
||||
OPENCLAW_GIT_DIR=...
|
||||
OPENCLAW_GIT_UPDATE=0|1
|
||||
@@ -1076,7 +1076,7 @@ Examples:
|
||||
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash
|
||||
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --no-onboard
|
||||
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --no-onboard --verify
|
||||
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --version main
|
||||
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method git --version main
|
||||
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method git --no-onboard
|
||||
EOF
|
||||
}
|
||||
@@ -2444,6 +2444,23 @@ is_explicit_package_install_spec() {
|
||||
[[ "$value" == *"://"* || "$value" == *"#"* || "$value" =~ ^(file|github|git\+ssh|git\+https|git\+http|git\+file|npm): ]]
|
||||
}
|
||||
|
||||
is_openclaw_source_package_install_spec() {
|
||||
local value="${1:-}"
|
||||
local normalized_value=""
|
||||
normalized_value="$(to_lowercase_ascii "$value")"
|
||||
normalized_value="${normalized_value#openclaw@}"
|
||||
|
||||
[[ "$normalized_value" == "main" ]] && return 0
|
||||
[[ "$normalized_value" =~ ^github:openclaw/openclaw($|[#/]) ]] && return 0
|
||||
|
||||
normalized_value="${normalized_value#git+}"
|
||||
[[ "$normalized_value" =~ ^https?://github\.com/openclaw/openclaw(\.git)?($|[?#]) ]] && return 0
|
||||
[[ "$normalized_value" =~ ^ssh://git@github\.com[:/]openclaw/openclaw(\.git)?($|[?#]) ]] && return 0
|
||||
[[ "$normalized_value" =~ ^git://github\.com/openclaw/openclaw(\.git)?($|[?#]) ]] && return 0
|
||||
[[ "$normalized_value" =~ ^git@github\.com:openclaw/openclaw(\.git)?($|[?#]) ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
can_resolve_registry_package_version() {
|
||||
local value="${1:-}"
|
||||
local normalized_value=""
|
||||
@@ -2499,6 +2516,12 @@ install_openclaw() {
|
||||
OPENCLAW_VERSION="latest"
|
||||
fi
|
||||
|
||||
if is_openclaw_source_package_install_spec "${OPENCLAW_VERSION}"; then
|
||||
ui_error "npm installs do not support OpenClaw GitHub source targets like '${OPENCLAW_VERSION}'."
|
||||
ui_info "Use --install-method git --version main for the moving main checkout, or use latest, beta, an exact version, or a built .tgz package."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local resolved_version=""
|
||||
if can_resolve_registry_package_version "${OPENCLAW_VERSION}"; then
|
||||
resolved_version="$(npm view "${package_name}@${OPENCLAW_VERSION}" version 2>/dev/null || true)"
|
||||
|
||||
Reference in New Issue
Block a user