Files
MeowOS Dev 245bee2946 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 软件仓库
2026-08-30 01:12:34 +08:00

86 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
# ondev.sh — R3 Pro II 真机验证编排(手动分步,每步独立 ssh+timeout,规避挂起)
# 用法: ondev.sh <check|deploy|restart|shot|inject|flag|status|clean>
# 前置: 设备 IP <alt_device_ip>,密钥 ~/Project/R3ProII/ssh_keys/<device_key>
set -u
DEV="<alt_device_ip>"
KEY="$HOME/Project/R3ProII/ssh_keys/<device_key>"
SSH="ssh -i $KEY -o StrictHostKeyChecking=accept-new -o ConnectTimeout=8"
PATCH=~/Project/R3ProII/patch_v2/hiby_player_patched_v2
TAP=~/Project/R3ProII/patch_v2/uinput_tap/uinput_tap
WD=~/Project/R3ProII/patch_v2/meow_watchdog/meow_watchdog
s() { timeout 30 $SSH root@$DEV "$1"; }
check() {
echo "== device state =="
s 'ps | grep hiby_player | grep -v grep | wc -l'
s 'ls /data/recovery_all 2>/dev/null && echo FLAG_EXISTS || echo no_flag'
s 'mount | grep -c overlay'
s 'cat /sys/class/backlight/backlight_pwm0/brightness 2>/dev/null'
s 'ls /data/mnt/sd_0/MeowAPPs/ 2>/dev/null && echo sd_ok || echo sd_missing'
}
flag() { s 'ls -la /data/recovery_all 2>/dev/null && rm -f /data/recovery_all && echo FLAG_REMOVED || echo no_flag'; }
deploy() {
echo "== push files =="
timeout 40 $SSH root@$DEV "cat > /data/hiby_player_patched_v2" < $PATCH || { echo "push patched FAIL"; return 1; }
timeout 40 $SSH root@$DEV "cat > /data/uinput_tap" < $TAP || { echo "push uinput_tap FAIL"; return 1; }
timeout 40 $SSH root@$DEV "cat > /usr/data/meow_watchdog" < $WD || { echo "push watchdog FAIL"; return 1; }
s 'chmod +x /data/hiby_player_patched_v2 /data/uinput_tap /usr/data/meow_watchdog; ls -la /data/hiby_player_patched_v2 /data/uinput_tap /usr/data/meow_watchdog'
s 'md5sum /data/hiby_player_patched_v2'
}
restart() {
echo "== restart player (safe order) =="
s 'rm -f /data/recovery_all'
s 'ps | grep hiby_player.sh | grep -v grep'
s 'ps | grep hiby_player | grep -v grep'
s 'kill $(ps | grep hiby_player.sh | grep -v grep | awk "{print \$1}") 2>/dev/null; sleep 1; kill -9 $(ps | grep "hiby_player$" | grep -v grep | awk "{print \$1}") 2>/dev/null; sleep 1; echo cleaned'
s 'ps | grep hiby_player | grep -v grep | wc -l'
echo "-- launching (nohup) --"
s 'nohup /usr/bin/hiby_player >/dev/null 2>&1 & echo launched'
sleep 5
s 'ps | grep hiby_player | grep -v grep | wc -l'
s 'ls /data/recovery_all 2>/dev/null && echo FLAG || echo no_flag'
}
shot() {
local name=${1:-shot}
s 'dd if=/dev/fb0 of=/data/x.raw bs=691200 count=1 2>/dev/null'
timeout 30 $SSH root@$DEV "cat /data/x.raw" > ~/Project/R3ProII/device_test/$name.raw
python3 ~/Project/R3ProII/device_test/fb2png.py ~/Project/R3ProII/device_test/$name.raw ~/Project/R3ProII/device_test/$name.png
echo "saved device_test/$name.png ($(stat -c%s ~/Project/R3ProII/device_test/$name.png) B)"
}
inject() {
# inject <x> <y> [devpath]
local x=$1 y=$2 dev=${3:-/dev/input/event1}
s "/data/uinput_tap inject $x $y $dev"
}
status() { s 'ps | grep hiby_player; echo ---; mount | grep -E "overlay|bind"; echo ---; ls /tmp/meow* 2>/dev/null; echo ---; ls /data/ | head -20'; }
clean() {
echo "== restore clean =="
s 'rm -f /data/recovery_all'
s 'umount /data/overlay/hiby_player 2>/dev/null; umount /usr/bin/meow_watchdog 2>/dev/null; umount /data/mnt/sd_0/MeowAPPs 2>/dev/null; echo unmounted'
s 'kill $(ps | grep hiby_player.sh | grep -v grep | awk "{print \$1}") 2>/dev/null; sleep 1; kill -9 $(ps | grep "hiby_player$" | grep -v grep | awk "{print \$1}") 2>/dev/null; sleep 1; echo killed'
s 'nohup /usr/bin/hiby_player >/dev/null 2>&1 & echo relaunched'
sleep 5
s 'echo 101 > /sys/class/backlight/backlight_pwm0/brightness; ps | grep hiby_player | grep -v grep | wc -l; ls /data/recovery_all 2>/dev/null || echo no_flag'
}
case "${1:-}" in
check) check ;;
flag) flag ;;
deploy) deploy ;;
restart) restart ;;
shot) shot "${2:-shot}" ;;
inject) inject "${2:-0}" "${3:-0}" "${4:-/dev/input/event1}" ;;
status) status ;;
clean) clean ;;
*) echo "usage: $0 check|flag|deploy|restart|shot [name]|inject x y [dev]|status|clean"; exit 1 ;;
esac