mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 07:45:13 +08:00
🎁 Sync 2026-04-03 23:44:19
This commit is contained in:
1 parent
c3c67665a1
commit
3b13fc3626
4 files changed
+42
-71
No files matched your search
@@ -205,19 +205,15 @@ fi
|
||||
# 问题: 旧版本写入的是 "openclaw-qqbot",但实际插件名是 "@tencent-connect/openclaw-qqbot"
|
||||
fix_plugin_config() {
|
||||
local qqbot_ext_dir="${OC_DATA}/.openclaw/extensions/openclaw-qqbot"
|
||||
local weixin_ext_dir="${OC_DATA}/.openclaw/extensions/openclaw-weixin"
|
||||
[ ! -d "$qqbot_ext_dir" ] && [ ! -d "$weixin_ext_dir" ] && return
|
||||
[ ! -d "$qqbot_ext_dir" ] && return
|
||||
[ ! -f "$CONFIG_FILE" ] && return
|
||||
|
||||
"$NODE_BIN" -e "
|
||||
const fs=require('fs');
|
||||
try{
|
||||
const d=JSON.parse(fs.readFileSync('${CONFIG_FILE}','utf8'));
|
||||
if(!d.plugins)d.plugins={};
|
||||
let modified=false;
|
||||
if(!d.plugins)d.plugins={};
|
||||
if(!Array.isArray(d.plugins.allow))d.plugins.allow=[];
|
||||
const hasWechat=fs.existsSync('${weixin_ext_dir}'); if(hasWechat && !d.plugins.allow.includes("@tencent-weixin/openclaw-weixin")) { d.plugins.allow.push("@tencent-weixin/openclaw-weixin"); modified=true; }
|
||||
|
||||
|
||||
// 修复 plugins.allow 数组中的插件名称
|
||||
if(Array.isArray(d.plugins.allow)){
|
||||
|
||||
@@ -389,34 +389,9 @@ install_openclaw() {
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_openclaw_user() {
|
||||
if ! id openclaw >/dev/null 2>&1; then
|
||||
echo " 正在创建 openclaw 系统用户..."
|
||||
local OC_UID=1000
|
||||
while grep -q "^[^:]*:x:${OC_UID}:" /etc/passwd 2>/dev/null; do
|
||||
OC_UID=$((OC_UID + 1))
|
||||
done
|
||||
local OC_GID=$OC_UID
|
||||
while grep -q "^[^:]*:x:${OC_GID}:" /etc/group 2>/dev/null; do
|
||||
OC_GID=$((OC_GID + 1))
|
||||
done
|
||||
if ! grep -q "^openclaw:" /etc/passwd 2>/dev/null; then
|
||||
echo "openclaw:x:${OC_UID}:${OC_GID}:openclaw:/opt/openclaw/data:/bin/false" >> /etc/passwd
|
||||
fi
|
||||
if ! grep -q "^openclaw:" /etc/shadow 2>/dev/null; then
|
||||
echo "openclaw:x:0:0:99999:7:::" >> /etc/shadow
|
||||
fi
|
||||
if ! grep -q "^openclaw:" /etc/group 2>/dev/null; then
|
||||
echo "openclaw:x:${OC_GID}:" >> /etc/group
|
||||
fi
|
||||
log_info "用户 openclaw 创建成功"
|
||||
fi
|
||||
}
|
||||
|
||||
init_openclaw() {
|
||||
echo ""
|
||||
echo "=== 初始化 OpenClaw ==="
|
||||
ensure_openclaw_user
|
||||
|
||||
# 创建数据目录
|
||||
ensure_mkdir "$OC_DATA/.openclaw"
|
||||
|
||||
Reference in new issue
Block a user