chore: import private baseline from gitea state
This commit is contained in:
40
deploy/server-maibot/docker-entrypoint.offline.sh
Normal file
40
deploy/server-maibot/docker-entrypoint.offline.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
ADAPTER_TEMPLATE="/MaiMBot/plugin-templates/MaiBot-Napcat-Adapter"
|
||||
ADAPTER_TARGET="/MaiMBot/plugins/MaiBot-Napcat-Adapter"
|
||||
CONFIG_DIR="/MaiMBot/config"
|
||||
BOT_CONFIG_PATH="$CONFIG_DIR/bot_config.toml"
|
||||
MODEL_CONFIG_PATH="$CONFIG_DIR/model_config.toml"
|
||||
|
||||
mkdir -p /MaiMBot/plugins
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
|
||||
if [ ! -e "$ADAPTER_TARGET" ] && [ -d "$ADAPTER_TEMPLATE" ]; then
|
||||
cp -a "$ADAPTER_TEMPLATE" "$ADAPTER_TARGET"
|
||||
fi
|
||||
|
||||
if [ ! -f "$BOT_CONFIG_PATH" ] || [ ! -f "$MODEL_CONFIG_PATH" ]; then
|
||||
/MaiMBot/.venv/bin/python -c "from src.config.config import config_manager; print('config initialized')"
|
||||
fi
|
||||
|
||||
if [ -f "$BOT_CONFIG_PATH" ]; then
|
||||
/MaiMBot/.venv/bin/python - "$BOT_CONFIG_PATH" <<'PY'
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
path = Path(sys.argv[1])
|
||||
content = path.read_text(encoding="utf-8")
|
||||
updated = re.sub(
|
||||
r'(^host\s*=\s*)"(127\.0\.0\.1|localhost)"',
|
||||
r'\1"0.0.0.0"',
|
||||
content,
|
||||
flags=re.MULTILINE,
|
||||
)
|
||||
if updated != content:
|
||||
path.write_text(updated, encoding="utf-8")
|
||||
PY
|
||||
fi
|
||||
|
||||
exec /MaiMBot/.venv/bin/python bot.py "$@"
|
||||
Reference in New Issue
Block a user