mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 18:53:56 +08:00
🍉 Sync 2026-05-16 08:37:13
This commit is contained in:
1 parent
8c1c3dd8ec
commit
8ed4c2a2a5
32 files changed
+1145
-234
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
fail() {
|
||||
echo "FAIL: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
grep -q "OC_TESTED_VERSION=\"2026.5.12\"" root/usr/bin/openclaw-env || fail "tested OpenClaw version not pinned"
|
||||
grep -q "oc_assert_node_min_version" root/usr/bin/openclaw-env || fail "Node.js minimum version check missing"
|
||||
|
||||
grep -q "wechat.htm" Makefile || fail "Makefile must install wechat.htm"
|
||||
grep -q "luci-app-openclaw.json" Makefile || fail "Makefile must install rpcd ACL"
|
||||
if grep -q "openclaw.zh-cn.lmo" Makefile; then
|
||||
fail "main package must not install openclaw.zh-cn.lmo"
|
||||
fi
|
||||
|
||||
if grep -q 'export HOME="$OC_DATA"' root/etc/profile.d/openclaw.sh; then
|
||||
fail "profile must not export HOME globally"
|
||||
fi
|
||||
grep -q 'HOME="$OC_DATA"' root/etc/profile.d/openclaw.sh || fail "openclaw wrapper must inject HOME locally"
|
||||
|
||||
if grep -q "chmod -R 777" luasrc/controller/openclaw.lua; then
|
||||
fail "uninstall path must not chmod -R 777"
|
||||
fi
|
||||
grep -q "is_safe_openclaw_root" luasrc/controller/openclaw.lua || fail "uninstall safety check missing"
|
||||
grep -q "local q_install_path = shellquote(install_path)" luasrc/controller/openclaw.lua || fail "uninstall rm must shellquote install_path"
|
||||
grep -q "rm -rf \" .. q_install_path" luasrc/controller/openclaw.lua || fail "uninstall rm must use quoted install_path"
|
||||
|
||||
grep -q "command -v python3" luasrc/controller/openclaw.lua || fail "wechat install must check python3"
|
||||
grep -q "ensure_openclaw_user" luasrc/controller/openclaw.lua || fail "wechat install must ensure openclaw user"
|
||||
grep -q "NPM_CONFIG_CACHE" luasrc/controller/openclaw.lua || fail "wechat install must set npm cache"
|
||||
grep -q "openclaw-weixin" root/etc/init.d/openclaw || fail "weixin channel migration missing"
|
||||
|
||||
grep -q "var url = 'http://'" luasrc/view/openclaw/console.htm || fail "console must force HTTP gateway URL"
|
||||
grep -q "existing.src" luasrc/view/openclaw/console.htm || fail "console iframe must refresh token URL"
|
||||
|
||||
grep -q "root/usr/libexec" scripts/build_ipk.sh || fail "ipk script must package shell helpers"
|
||||
grep -q "root/usr/libexec" scripts/build_run.sh || fail "run script must package shell helpers"
|
||||
|
||||
echo "ok"
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
. ./root/usr/libexec/openclaw-node.sh
|
||||
|
||||
fail() {
|
||||
echo "FAIL: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ "$(oc_normalize_node_version v22.16.0)" = "22.16.0" ] || fail "normalize v"
|
||||
oc_node_version_ge 22.16.0 22.16.0 || fail "exact version"
|
||||
oc_node_version_ge 22.16.1 22.16.0 || fail "patch version"
|
||||
oc_node_version_ge 23.0.0 22.16.0 || fail "major version"
|
||||
if oc_node_version_ge 22.15.1 22.16.0; then
|
||||
fail "older minor accepted"
|
||||
fi
|
||||
|
||||
echo "ok"
|
||||
@@ -0,0 +1,32 @@
|
||||
package.path = "./luasrc/?.lua;./luasrc/?/?.lua;" .. package.path
|
||||
|
||||
local paths = require "openclaw.paths"
|
||||
|
||||
local function eq(actual, expected, label)
|
||||
if actual ~= expected then
|
||||
error(string.format("%s: expected %q, got %q", label, tostring(expected), tostring(actual)), 2)
|
||||
end
|
||||
end
|
||||
|
||||
local function check(input, expected_base, expected_root)
|
||||
local derived = paths.derive_paths(input)
|
||||
eq(derived.install_path, expected_base, "install_path")
|
||||
eq(derived.oc_root, expected_root, "oc_root")
|
||||
eq(derived.node_base, expected_root .. "/node", "node_base")
|
||||
eq(derived.oc_global, expected_root .. "/global", "oc_global")
|
||||
eq(derived.oc_data, expected_root .. "/data", "oc_data")
|
||||
end
|
||||
|
||||
check(nil, "/opt", "/opt/openclaw")
|
||||
check("", "/opt", "/opt/openclaw")
|
||||
check("/mnt/data", "/mnt/data", "/mnt/data/openclaw")
|
||||
check("/mnt/data/openclaw", "/mnt/data", "/mnt/data/openclaw")
|
||||
check("/mnt/data/", "/mnt/data", "/mnt/data/openclaw")
|
||||
|
||||
eq(paths.normalize_install_path("relative/path"), nil, "relative path rejected")
|
||||
eq(paths.normalize_install_path("/mnt/data bad"), nil, "space rejected")
|
||||
eq(paths.normalize_install_path("/"), nil, "root rejected")
|
||||
eq(paths.is_safe_openclaw_root("/mnt/data/openclaw"), true, "safe root")
|
||||
eq(paths.is_safe_openclaw_root("/mnt/data"), false, "unsafe root")
|
||||
|
||||
print("ok")
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
. ./root/usr/libexec/openclaw-paths.sh
|
||||
|
||||
fail() {
|
||||
echo "FAIL: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
oc_load_paths "/mnt/data/openclaw"
|
||||
[ "$OPENCLAW_INSTALL_PATH" = "/mnt/data" ] || fail "strip trailing openclaw"
|
||||
[ "$OC_ROOT" = "/mnt/data/openclaw" ] || fail "derive root"
|
||||
|
||||
if oc_normalize_install_path "relative/path" >/dev/null 2>&1; then
|
||||
fail "relative path must be rejected"
|
||||
fi
|
||||
|
||||
if oc_normalize_install_path "/mnt/data bad" >/dev/null 2>&1; then
|
||||
fail "path with whitespace must be rejected"
|
||||
fi
|
||||
|
||||
oc_safe_openclaw_root "/mnt/data/openclaw" || fail "safe root rejected"
|
||||
if oc_safe_openclaw_root "/mnt/data"; then
|
||||
fail "non-openclaw root accepted"
|
||||
fi
|
||||
|
||||
quoted=$(oc_quote "/mnt/a'b/openclaw")
|
||||
[ "$quoted" = "'/mnt/a'\\''b/openclaw'" ] || fail "shell quote"
|
||||
|
||||
echo "ok"
|
||||
Reference in new issue
Block a user