setup_termux_boot.sh 1.17 KB
#!/bin/bash
# Termux Boot 启动脚本 — 手机重启后自动启动 hermes + daemon
# 安装方式:
#   1. 确保已安装 Termux:Boot 应用
#   2. mkdir -p ~/.termux/boot
#   3. cp setup_termux_boot.sh ~/.termux/boot/start-hermes.sh
#   4. chmod +x ~/.termux/boot/start-hermes.sh
#   5. 重启手机验证

export PATH=/data/data/com.termux/files/usr/bin:$PATH

# 启动 frida-server (如果已安装)
if [ -f "/data/local/tmp/frida-server" ]; then
    su -c "/data/local/tmp/frida-server &"
fi

# 启动微信 (如果未运行)
if ! su -c "pgrep -x com.tencent.mm" > /dev/null 2>&1; then
    su -c "am start -n com.tencent.mm/.ui.LauncherUI"
    sleep 5
fi

# 启动 hermes (lemonPCRM) 在 proot Ubuntu 中
HERMES_DIR="/root/aipcrm"
proot-distro login --shared-home ubuntu -- bash -c \
    "cd $HERMES_DIR && npm start > /sdcard/hermes/hermes.log 2>&1 &"

sleep 5

# 启动守护进程 (在 proot Ubuntu 中)
DAEMON_DIR="/root/local-testkit"
proot-distro login --shared-home ubuntu -- bash -c \
    "cd $DAEMON_DIR && python3 hermes_wechat_daemon.py --daemon"

# 发送启动通知
termux-notification \
    --title "Hermes WeChat" \
    --content "hermes + daemon 已启动" \
    --priority low