Files
blackbird/redirect80/_run.sh
T
qing 08df3929b2 feat(core): services.yaml 启动配置 + _run.sh 统一参数透传
Step 1: init.txt → services.yaml
- 新增 InitParser (yaml-cpp), 支持 YAML/TXT 双模式解析, 向后兼容 init.txt
- 新增 services.yaml 声明式服务配置 (name/cmd/args/depends_on/sleep_before)
- 改造 pmc_mtd.cpp 集成 InitParser, 支持目录/.yaml/.txt 三种路径模式
- Makefile 添加 InitParser 编译目标 + -lyaml-cpp 链接
- setup 脚本添加 libyaml-cpp-dev / yaml-cpp-devel 依赖
- core/_run.sh 改为 -i . (目录模式, 自动查找 services.yaml → init.txt)

Step 2: 11 个 _run.sh 统一参数透传
- 8 个脚本改动: 追加 "$@" / 移除 sleep / 修引号
- waf 保留 -c config.yaml 作为脚本默认值
- services.yaml waf args 改为 [] 避免重复传递
- 开发方案文档: docs/reports/core_services_yaml_dev_doc.md
2026-08-10 03:16:28 +08:00

17 lines
631 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
cd "$(dirname "$0")" || exit
source venv/bin/activate
# 80 端口是特权端口(<1024),需要 CAP_NET_BIND_SERVICE 能力
# 尝试自动设置 cap(失败不阻塞,用户可手动 sudo 或用 systemd AmbientCapabilities)
_python_bin="$(readlink -f venv/bin/python3)"
if command -v setcap &>/dev/null; then
if sudo setcap 'cap_net_bind_service=+ep' "$_python_bin" 2>/dev/null; then
echo "[redirect80] 已为 $_python_bin 设置 cap_net_bind_service"
else
echo "[redirect80] ⚠ 无法设置 cap_net_bind_service,可能需要 root 运行"
fi
fi
exec python3 redirect80.py "$@"