MeowOS for HiBy R3 Pro II — 公共发布版本(历史已重置)

• 全新单提交:清除含敏感信息的旧历史(sudo 口令、内网 IP、SSH 密钥路径、热点 SSID、设备 MAC)
• 本地开发文档/测试记录/构建脚本全部移入 gitignored 的 devdocs/ 与 scripts/build/(不入库)
• 保留:MeowOS 源码(launcher/watchdog/bootmenu/meow_svcd/SDK)、项目规范文档、mips-repo
增补组件:SDK 统一日志+通知 API、meow_svcd 服务管理器、mips-repo 软件仓库
This commit is contained in:
MeowOS Dev committed 2026-08-30 01:12:34 +08:00
commit 245bee2946
136 files changed
+32730

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
#!/bin/sh
#
# S99ssh - HiBy R3 Pro II: dropbear SSH 服务 + ADB 持久自启
#
# 设计要点:
# * dropbear 为静态 musl 二进制(/usr/sbin/dropbear),仅 pubkey 认证
# (编译时已去掉 password auth,无需 /etc/passwd 写密码)。
# * /root 位于只读 squashfs,authorized_keys 放可写 UBIFS 卷:
# /usr/data/ssh/.ssh/authorized_keys
# 并用 bind-mount 把 /usr/data/ssh 挂到 /root(/root 在固件中是空目录),
# dropbear 按 passwd 的 pw_dir=/root 查找 ~/.ssh/authorized_keys。
# * host key 首次开机用 dropbearkey 生成到 /usr/data/ssh/
# (dropbear -R 的运行时生成路径是只读的 /etc/dropbear,不可用)。
# * 日志:/usr/data/ssh.log(= /data/ssh.log)。
# * 顺带删除 /usr/data/disableadb,使 ADB 在 USB 连接时持久自启
# (etc/init.d/adb/S440adb 检查该文件存在则不起 adb)。
#
case "$1" in
start)
echo "Starting dropbear sshd ..."
# ADB 持久自启:清掉禁用标记
rm -f /usr/data/disableadb
# UBIFS 未挂好/不可写则放弃(避免在只读 squashfs 上瞎写)
[ -d /usr/data ] && [ -w /usr/data ] || {
echo "S99ssh: /usr/data not writable, abort" > /dev/console 2>&1
exit 0
}
mkdir -p /usr/data/ssh/.ssh
chmod 700 /usr/data/ssh
chmod 700 /usr/data/ssh/.ssh
# 首次开机:从只读模板写入 authorized_keys
if [ ! -f /usr/data/ssh/.ssh/authorized_keys ] && [ -f /etc/dropbear/authorized_keys ]; then
cp /etc/dropbear/authorized_keys /usr/data/ssh/.ssh/authorized_keys
fi
chmod 600 /usr/data/ssh/.ssh/authorized_keys 2>/dev/null
# /root 只读 -> bind 可写的 ssh 工作目录过去
mount --bind /usr/data/ssh /root 2>/dev/null
# MeowAPPs 应用加载器: 把看门狗复制到可写卷 (cave exec 路径 /usr/data/meow_watchdog)
if [ -f /usr/bin/meow_watchdog ]; then
cp -f /usr/bin/meow_watchdog /usr/data/meow_watchdog 2>/dev/null
chmod 755 /usr/data/meow_watchdog 2>/dev/null
fi
# 首次开机:生成 ed25519 host key
if [ ! -f /usr/data/ssh/dropbear_ed25519_host_key ]; then
/usr/sbin/dropbearkey -t ed25519 -f /usr/data/ssh/dropbear_ed25519_host_key \
>> /usr/data/ssh.log 2>&1
chmod 600 /usr/data/ssh/dropbear_ed25519_host_key
fi
# 启动 dropbear:仅 pubkey 认证,禁用端口转发
/usr/sbin/dropbear -j -k \
-r /usr/data/ssh/dropbear_ed25519_host_key \
-p 22 \
-P /usr/data/ssh/dropbear.pid \
>> /usr/data/ssh.log 2>&1 &
;;
stop)
killall dropbear 2>/dev/null
sleep 1
umount /root 2>/dev/null
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0