-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmgr.sh
More file actions
executable file
·79 lines (64 loc) · 2.12 KB
/
mgr.sh
File metadata and controls
executable file
·79 lines (64 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
deployNginx() {
pushd docker/basic-services || return 1
trap 'popd' EXIT
docker compose -f docker-compose.yaml up nginx -d
}
deployZeroClaw() {
set -a
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/.env"
pushd docker/claws > /dev/null || return 1
trap 'popd > /dev/null' EXIT
local GID="$(id -g)"
export GID
export UID
mkdir -p ~/.zeroclaw/workspace
docker compose -f docker-compose.yaml up zeroclaw -d --wait
cmd="chown $UID:$GID /zeroclaw-data/.zeroclaw/config.toml"
docker exec -it -u root zeroclaw $cmd
configPath=~/.zeroclaw/config.toml
sed -i 's/host = "127\.0\.0\.1"/host = "0.0.0.0"/' $configPath
sed -i 's/allow_public_bind\s*=\s*false/allow_public_bind = true/' $configPath
sed -i 's/require_pairing\s*=\s*true/require_pairing = false/' $configPath
docker restart zeroclaw
set +a
}
deployOpenClaw() {
set -a
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/.env"
pushd docker/claws > /dev/null || return 1
trap 'popd > /dev/null' EXIT
local GID="$(id -g)"
export GID
export UID
mkdir -p ~/.openclaw/{data,workspace}
docker compose -f docker-compose.yaml up openclaw -d --wait
docker exec -it openclaw openclaw config set --batch-json '[
{"path": "gateway.controlUi.allowedOrigins", "value": ["*"]},
{"path": "gateway.controlUi.allowInsecureAuth", "value": true},
{"path": "gateway.controlUi.dangerouslyDisableDeviceAuth", "value": true},
{"path": "gateway.bind", "value": "lan"}
]'
set +a
}
main() {
# 检查是否传递了函数名
if [ $# -lt 1 ]; then
echo "用法: $0 <函数名> [参数]"
exit 1
fi
# 获取函数名
local func_name="$1"
shift # 移除函数名,剩下的参数作为函数参数
# 检查函数是否存在
if declare -f "$func_name" > /dev/null; then
# 调用函数,传递剩余参数
"$func_name" "$@"
echo "ok"
else
echo "错误: 函数 '$func_name' 不存在"
exit 1
fi
}
main $@