# AI 自动安装指令：中兴 F50 / F50 Pro 刷原生 OpenWrt 25.12.5 + PassWall + 并发中继

将本文件交给带有终端和 USB 访问权限的本地 AI 工具（如 Antigravity、WorkBuddy、Codex、Claude Code、Cursor），AI 将按以下 5 个阶段安全推进：

## 阶段 0：硬件识别与风险拦截
1. 询问并确认用户手里是哪款中兴设备：
   - **F50 Pro 插卡版（MU3356 / B28 / board_id=6）** → 走 `tanjiu90/f50pro-dualboot-kit`
   - **F50 Pro 内置双 eSIM 版（B15 / board_id=1）** → 走 `tanjiu90/f50pro-dualboot-kit`
   - **标准版 F50（MU300）** → 走 `dikeckaan/mu300-linux`（高于 B09 需先用 `dikeckaan/zte-f50-toolkit` 降级）
   - **F40 / V50** → 明确告知不支持原生 OpenWrt 并停止
2. 若在 macOS 上且电脑 Wi-Fi 也是 `192.168.0.x`，提醒用户备份前临时断开 Wi-Fi 或用 `--interface <usb_enX>` 避免路由冲突。

## 阶段 1：强制整机 81 分区备份
1. 克隆 `https://github.com/tanjiu90/f50pro-dualboot-kit.git` 并运行 `sudo ./f50pro-dualboot.sh`。
2. 必须先完成约 7 GB 的整机 81 分区备份并校验目录非空，严禁跳过备份直接刷机。

## 阶段 2：写入 Slot B 原生 OpenWrt 25.12.5
1. 使用本机备份构建双系统镜像并刷入 Slot B（Slot A 保留原厂安卓 15，长按实体键 5 秒切换）。
2. 记录刷机脚本末尾打印的 `root` 初始密码并确认能 SSH 登录 `root@192.168.77.1`。

## 阶段 3：插卡版 SIM 卡槽 1 拨号 + 修复信号红灯
1. 若为插卡版（`board_id=6`），询问用户运营商（电信 `ctnet` / 移动 `cmnet` / 联通 `3gnet`），执行：
   ```sh
   uci set unisoc_modem.main.data_sim='1'
   uci set network.wan.sim_slot='1'
   uci set network.wan.apn='<APN>'
   uci commit unisoc_modem && uci commit network
   echo 1 > /run/mu300-data-sim-actual
   /etc/init.d/f50pro-leds restart
   ifup wan
   grep -q 'mu300-data-sim-actual' /etc/rc.local || sed -i '/^exit 0/i echo 1 > /run/mu300-data-sim-actual\n/etc/init.d/f50pro-leds restart' /etc/rc.local
   ```
2. 验证 5G 拨号获取到公网/运营商 IP 且机身不再亮红灯。

## 阶段 4：安装 OpenWrt 25.12 PassWall（apk）
1. 下载配套两个 `.apk`（来自 `https://pocket-router-guides.pages.dev/files/f50-openwrt/`）并 `scp` 到 `/tmp/pw/`。
2. 在路由器执行：
   ```sh
   apk update
   apk add xray-core sing-box chinadns-ng geoview v2ray-geoip v2ray-geosite ipt2socks kmod-nft-socket kmod-nft-tproxy
   apk add --allow-untrusted /tmp/pw/*.apk
   rm -rf /tmp/luci-indexcache* /tmp/luci-modulecache/
   /etc/init.d/uhttpd restart
   ```
3. 引导用户打开 `http://192.168.77.1` → 服务 → PassWall 导入订阅并启动。

## 阶段 5（可选）：配置并发 Wi-Fi 6 AP+STA 无线中继
1. 配置家里 Wi-Fi（`wwan`, `metric=10`）优先于 5G（`wan`, `metric=40`）。
2. 写入 `/usr/local/bin/f50pro-ap-keepalive.sh` 移除 `/var/run/hostapd-phy0.conf` 中的 `start_disabled=1`，如有 MAC 冲突则设置独立本地管理 BSSID，并加入 `/etc/rc.local`。
