mirror of
https://github.com/hotwa/luci-app-openclaw.git
synced 2026-03-30 20:25:44 +00:00
Auto-link legacy ARM64 musl node assets
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Shared OpenClaw Node.js runtime/version helpers.
|
||||
|
||||
OPENCLAW_LEGACY_ARM64_MUSL_INTERPRETER="${OPENCLAW_LEGACY_ARM64_MUSL_INTERPRETER:-/opt/openclaw/node/lib/ld-musl-aarch64.so.1}"
|
||||
|
||||
oc_normalize_node_version() {
|
||||
local version="${1:-}"
|
||||
local old_ifs
|
||||
@@ -67,6 +69,15 @@ oc_read_node_version() {
|
||||
oc_normalize_node_version "$version"
|
||||
}
|
||||
|
||||
oc_node_requires_opt_compat() {
|
||||
local node_bin="${1:-}"
|
||||
|
||||
[ -n "$node_bin" ] || return 1
|
||||
[ -f "$node_bin" ] || return 1
|
||||
|
||||
grep -aqF "$OPENCLAW_LEGACY_ARM64_MUSL_INTERPRETER" "$node_bin"
|
||||
}
|
||||
|
||||
oc_select_node_release_asset_url() {
|
||||
local json_file="${1:-}"
|
||||
local node_arch="${2:-}"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Shared OpenClaw install-root and derived-path helpers.
|
||||
|
||||
OPENCLAW_DEFAULT_INSTALL_ROOT="${OPENCLAW_DEFAULT_INSTALL_ROOT:-/opt}"
|
||||
OPENCLAW_OPT_COMPAT_ROOT="${OPENCLAW_OPT_COMPAT_ROOT:-/opt}"
|
||||
|
||||
oc_normalize_install_root() {
|
||||
local path="$1"
|
||||
@@ -66,6 +67,30 @@ oc_install_root_uses_opt_workaround() {
|
||||
[ "$(oc_normalize_install_root "${1:-$OPENCLAW_INSTALL_ROOT}")" = "/opt" ]
|
||||
}
|
||||
|
||||
oc_ensure_opt_compat_link() {
|
||||
local target_root="$1"
|
||||
local compat_root compat_link current_target
|
||||
|
||||
target_root="$(oc_normalize_install_root "$target_root")"
|
||||
[ "$target_root" = "/opt" ] && return 0
|
||||
|
||||
compat_root="$(oc_normalize_install_root "$OPENCLAW_OPT_COMPAT_ROOT")"
|
||||
compat_link="${compat_root}/openclaw"
|
||||
|
||||
if [ -L "$compat_link" ]; then
|
||||
current_target="$(readlink "$compat_link" 2>/dev/null || true)"
|
||||
[ "$current_target" = "$target_root" ] && return 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -e "$compat_link" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "$compat_root"
|
||||
ln -s "$target_root" "$compat_link"
|
||||
}
|
||||
|
||||
oc_print_env() {
|
||||
oc_load_paths "$1"
|
||||
cat <<EOF
|
||||
@@ -74,5 +99,6 @@ OC_ROOT=$OC_ROOT
|
||||
NODE_BASE=$NODE_BASE
|
||||
OC_GLOBAL=$OC_GLOBAL
|
||||
OC_DATA=$OC_DATA
|
||||
OPENCLAW_OPT_COMPAT_ROOT=$OPENCLAW_OPT_COMPAT_ROOT
|
||||
EOF
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user