feat(storage): support configurable install root

Add a LuCI install-root input, persist the selected path in UCI,
and route install, status, backup, uninstall, and runtime scripts
through the configured storage root for new installs.

Reference: custom install root flow
This commit is contained in:
2026-03-18 13:48:07 +08:00
parent ee10bb0bd5
commit 68f24e6658
17 changed files with 739 additions and 122 deletions

View File

@@ -0,0 +1,30 @@
#!/bin/sh
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
REPO_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
. "$REPO_ROOT/root/usr/libexec/openclaw-paths.sh"
fail() {
echo "FAIL: $1" >&2
exit 1
}
oc_load_paths "/mnt/emmc/"
[ "$OPENCLAW_INSTALL_ROOT" = "/mnt/emmc" ] || fail "normalized install root"
[ "$OC_ROOT" = "/mnt/emmc/openclaw" ] || fail "derived OpenClaw root"
[ "$NODE_BASE" = "/mnt/emmc/openclaw/node" ] || fail "derived node path"
[ "$OC_GLOBAL" = "/mnt/emmc/openclaw/global" ] || fail "derived global path"
[ "$OC_DATA" = "/mnt/emmc/openclaw/data" ] || fail "derived data path"
oc_load_paths "relative/path"
[ "$OPENCLAW_INSTALL_ROOT" = "/opt" ] || fail "fallback install root"
[ "$OC_ROOT" = "/opt/openclaw" ] || fail "fallback OpenClaw root"
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT INT TERM
existing=$(oc_find_existing_path "$tmpdir/missing/nested")
[ "$existing" = "$tmpdir" ] || fail "nearest existing path"
echo "ok"