Distribute kernel via Gitea Debian apt repo; track stable not mainline

- Publish .deb packages to Gitea's built-in Debian registry (apt source)
  instead of Releases; CI uploads to pool/stable/main and stops creating
  Releases. One apt source line serves amd64 and arm64.
- Add linux-image-bbrv3 meta-package so `apt upgrade` tracks the latest
  stable kernel while older kernels stay installed for fallback. Its
  dependency is the actual built image package name (immune to localversion
  drift).
- Add bbrv3-config package shipping the BBR+CAKE+ECN sysctl drop-in as a
  conffile (applied via postinst), replacing the installer's sysctl write.
- Rewrite install.sh to add the apt source + signing key and install the
  meta package; keep the OS-version gate, status check and uninstall menu,
  plus an apt-mark hold escape hatch.
- select-stable-kernel.sh: pick the highest stable point release whose
  series is below mainline and has a matching BBRv3 patch, so a freshly-cut
  series (latest stable == mainline, e.g. 7.1) is not built. Currently 7.0.12.
- Exclude linux-libc-dev (clashes with the distro's headers) and drop the
  "by Joey" MODULE_DESCRIPTION step and release branding.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-06-17 18:26:05 +08:00
parent d888a9700e
commit b8ccd431ea
7 changed files with 521 additions and 407 deletions
@@ -0,0 +1,66 @@
# BBRv3 内核分发改造:迁移到 Gitea Debian apt 源
日期:2026-06-17
状态:已确认,进入实现
## 背景与目标
当前分发链路是「Gitea Releases 存 `.deb` + `curl|bash` 安装脚本手动 `dpkg -i`」。
目标是改成 **apt 源**,让用户 `apt upgrade` 即可时刻跟随最新 stable 内核,并顺带提升
安全性(GPG 签名、保留旧内核可回退、apt 解依赖)。
构建层(CI 每天编译 `.deb`)保留不变;本次只替换**分发/更新层**。
## 关键决策
1. **分发层 = Gitea 自带 Debian package registry**(实例已自建 Gitea,自动 PGP 签名)。
- 上传:`PUT {server}/api/packages/{owner}/debian/pool/{dist}/{comp}/upload`
- 用户源:`deb [signed-by=…] {server}/api/packages/{owner}/debian stable main`
- 公钥:`{server}/api/packages/{owner}/debian/repository.key`
- 统一用 `stable/main` 一个桶;架构由 `.deb` 自带,apt 按 `amd64/arm64` 自动取。
2. **更新策略 = 自动跟最新**:构建 meta-package `linux-image-bbrv3``Depends` 当前最新
`linux-image-<ver>-bbrv3`,版本随内核版本走。`apt upgrade` 跟最新,**旧内核保留可回退**。
谨慎用户 `apt-mark hold linux-image-bbrv3` 钉死。
3. **sysctl 配置入包**:新增 `bbrv3-config``Architecture: all`),把
`/etc/sysctl.d/99-bbrv3.conf`BBR + CAKE + ECN)作为 conffile 随包安装,`postinst`
`sysctl --system`。装包即配置,不再依赖脚本。`meta` 依赖它。
4. **迁移 = 干净切换 + 保留入口**CI 只发 registry,停发 Releases`install.sh` 仍是同一
`curl|bash` 入口,菜单不变,动作改成 apt(加源 + 导 key + 装 meta)。
5. **只发 `linux-image` / `linux-headers`,排除 `linux-libc-dev`**(避免覆盖发行版 userspace
头文件)与 `*-dbg*`
## 本次新增需求(用户补充)
6. **追踪 stable 而非 mainline**。根因:7.1.0 刚发布时 kernel.org「latest stable」== mainline
== 7.1,旧 preflight 直接取它就抓到 7.1;成熟 stable 实为 7.0.12。
**修法**`scripts/select-stable-kernel.sh``finger_banner` 选「带三段点号 `X.Y.Z`
`X.Y` 严格 `<` mainline、且仓库存在 `patches/bbrv3-linux-X.Y.patch`」中的最高版本。
三段号排除刚发布的 `7.1`,patch 闸门排除无补丁的 6.x → 当前命中 `7.0.12`。系列自动接棒。
7. **删除 joey 标签**:移除 `build.yml` 的「编译声明」步骤(注入 `Compiled & Optimized by
Joey` 的 `MODULE_DESCRIPTION`),让上游 patch 自带描述生效;Release 发布块里的 joey 文案
随该块一并删除。
## 改动清单
- `scripts/select-stable-kernel.sh`(新)— 选 stable 目标版本。
- `scripts/build-config-package.sh`(新)— 构建 `bbrv3-config_*_all.deb`。
- `scripts/build-meta-package.sh`(新)— 构建 `linux-image-bbrv3_<ver>_<arch>.deb`,依赖项
取自实际产出的内核包名(`dpkg-deb -f`),避免 localversion 后缀漂移。
- `.github/workflows/build.yml`(改)— preflight 用选择脚本 + 查 registry index 判存在;删
joey 步骤;构建 meta/config;发布改 registry `--upload-file`;停发 Release。
- `install.sh`(改)— 菜单动作改 apt:加源/导 key/装 meta(1)、装指定版本(2)、状态检查
(3,不变)、卸载并删源(4)。保留 OS 版本闸门、依赖安装、sudo 兜底。
- `README.md`(改)— 改写「内核来源/BBR 策略/菜单」,新增 apt 用法与 `apt-mark hold`。
## 前提(落地前核对)
- `git.chilldove.com` 启用 Packages → Debian registry(新版 Gitea 默认开)。
- CI 需 `PKG_TOKEN` secret(有 `write:package` scope);自动注入的 `GITHUB_TOKEN` 不保证有
包写权限。
- registry 保留历史版本以支撑「装指定版本」;将来再议 retention。
## 不做(YAGNI
- 不搭 aptly/reprepro、不自管 GPG keyGitea 全包)。
- 不做过渡期双发布。
- 不按发行版分多 distribution。