mirror of
https://github.com/hotwa/luci-app-openclaw.git
synced 2026-03-30 20:25:44 +00:00
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:
35
luasrc/openclaw/paths.lua
Normal file
35
luasrc/openclaw/paths.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local M = {}
|
||||
|
||||
local DEFAULT_INSTALL_ROOT = "/opt"
|
||||
|
||||
function M.normalize_install_root(path)
|
||||
if type(path) ~= "string" or path == "" then
|
||||
return DEFAULT_INSTALL_ROOT
|
||||
end
|
||||
|
||||
if path:sub(1, 1) ~= "/" then
|
||||
return DEFAULT_INSTALL_ROOT
|
||||
end
|
||||
|
||||
path = path:gsub("/+$", "")
|
||||
if path == "" then
|
||||
path = "/"
|
||||
end
|
||||
|
||||
return path
|
||||
end
|
||||
|
||||
function M.derive_paths(path)
|
||||
local install_root = M.normalize_install_root(path)
|
||||
local oc_root = (install_root == "/") and "/openclaw" or (install_root .. "/openclaw")
|
||||
|
||||
return {
|
||||
install_root = install_root,
|
||||
oc_root = oc_root,
|
||||
node_base = oc_root .. "/node",
|
||||
oc_global = oc_root .. "/global",
|
||||
oc_data = oc_root .. "/data",
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user