feat: setup-bind.sh one-shot initialization script

新增 scripts/setup-bind.sh,自动探测 Debian/Ubuntu vs RHEL/CentOS
布局(不靠 OS 名 if-elif,靠 /etc/bind vs /etc/named.conf 文件存在性),
执行 5 步:
  1. 装 bind 包(如未装)
  2. 建 zone 目录、设 bind:named 所有权 + 2770
  3. 建 named.conf.local 空文件、640
  4. 确保 named.conf 包含 named.conf.local(如未包含则追加)
  5. systemctl restart named

幂等:每步都先检查当前状态,已配置项跳过、避免破坏现有内容。

支持 --dry-run 模式打印将执行的命令而不真做,便于先审核。

README '安装 Web 应用' 步骤增加 dry-run + 真跑的两行示例。

测试:dev (Debian 12) --dry-run 通过,正确检测 Debian 布局、跳过
已配置步骤。
This commit is contained in:
Hermes
2026-07-24 17:47:45 +08:00
parent 903fe1704a
commit 16448d1666
2 changed files with 194 additions and 0 deletions
+11
View File
@@ -164,6 +164,17 @@ systemctl restart named
git clone ssh://git@git.cnbugs.com:10022/AI-Agent/dns-service.git
cd dns-service
# 一键初始化 BIND(自动识别 Debian/Ubuntu vs RHEL/CentOS):
# - 装 bind 包
# - 建 zone 目录、设权限
# - 建 named.conf.local、确保被主配置 include
# - 重启 named
# 默认是干跑模式,先看清楚会做什么:
sudo bash scripts/setup-bind.sh --dry-run
# 确认无误后真跑:
sudo bash scripts/setup-bind.sh
# 安装 Python 依赖
pip install -r requirements.txt