Auto-link legacy ARM64 musl node assets

This commit is contained in:
mm644706215
2026-03-21 15:38:26 +08:00
parent 40e0704dc9
commit 182623f67c
6 changed files with 84 additions and 0 deletions

View File

@@ -36,6 +36,8 @@ grep -Fq 'OPENCLAW_NODE_BINS_REPO="${OPENCLAW_NODE_BINS_REPO:-hotwa/luci-app-ope
grep -Fq 'NODE_SELF_HOST="${NODE_SELF_HOST:-https://github.com/${OPENCLAW_NODE_BINS_REPO}/releases/download/node-bins}"' "$ENV_SCRIPT" || fail "installer should derive node-bins release URL from hotwa repo"
grep -Fq 'NODE_RELEASE_API="${NODE_RELEASE_API:-https://api.github.com/repos/${OPENCLAW_NODE_BINS_REPO}/releases/tags/node-bins}"' "$ENV_SCRIPT" || fail "installer should derive node-bins release API from hotwa repo"
grep -Fq 'oc_select_node_release_asset_url' "$ENV_SCRIPT" || fail "installer should dynamically select ARM64 musl asset"
grep -Fq 'oc_node_requires_opt_compat "$NODE_BIN"' "$ENV_SCRIPT" || fail "installer should detect legacy opt-bound ARM64 musl node assets"
grep -Fq 'oc_ensure_opt_compat_link "$OC_ROOT"' "$ENV_SCRIPT" || fail "installer should create /opt compatibility symlink for legacy assets"
grep -Fq 'arm64_musl_url=$(resolve_arm64_musl_node_url "$node_ver") || exit 1' "$ENV_SCRIPT" || fail "installer should resolve ARM64 musl asset dynamically"
if grep -Fq 'mirror_list="${NODE_SELF_HOST}/${musl_tarball}"' "$ENV_SCRIPT"; then
fail "installer should not hardcode exact ARM64 musl asset path"

View File

@@ -51,6 +51,17 @@ if oc_read_node_version "$tmpdir/node-bad" >/dev/null 2>&1; then
fail "broken node binary should not be accepted"
fi
cat > "$tmpdir/node-legacy-opt" <<'EOF'
#!/bin/sh
/opt/openclaw/node/lib/ld-musl-aarch64.so.1
EOF
chmod +x "$tmpdir/node-legacy-opt"
oc_node_requires_opt_compat "$tmpdir/node-legacy-opt" || fail "legacy opt-bound node binary should be detected"
if oc_node_requires_opt_compat "$tmpdir/node-ok" >/dev/null 2>&1; then
fail "modern runnable node helper should not require opt compatibility"
fi
cat > "$tmpdir/node-bins-release.json" <<'EOF'
{
"tag_name": "node-bins",

View File

@@ -27,4 +27,22 @@ trap 'rm -rf "$tmpdir"' EXIT INT TERM
existing=$(oc_find_existing_path "$tmpdir/missing/nested")
[ "$existing" = "$tmpdir" ] || fail "nearest existing path"
export OPENCLAW_OPT_COMPAT_ROOT="$tmpdir/compat-opt"
target_root="$tmpdir/install-root/openclaw"
mkdir -p "$target_root"
oc_ensure_opt_compat_link "$target_root" || fail "compat symlink should be created for custom install root"
[ -L "$OPENCLAW_OPT_COMPAT_ROOT/openclaw" ] || fail "compat symlink should exist"
[ "$(readlink "$OPENCLAW_OPT_COMPAT_ROOT/openclaw")" = "$target_root" ] || fail "compat symlink should point to install root"
oc_ensure_opt_compat_link "$target_root" || fail "compat symlink should be idempotent"
conflict_root="$tmpdir/conflict-openclaw"
mkdir -p "$conflict_root"
rm -f "$OPENCLAW_OPT_COMPAT_ROOT/openclaw"
ln -s "$conflict_root" "$OPENCLAW_OPT_COMPAT_ROOT/openclaw"
if oc_ensure_opt_compat_link "$target_root" >/dev/null 2>&1; then
fail "compat symlink should fail when pointing at another install root"
fi
echo "ok"