# install tools install_tools () { echo "Installing tools, you MAY grant the operation by click the button..." sleep 2 set -e ( set -x adb install -r apk/Termux_v0.118.0_apkpure.com.apk adb install -r apk/ru.meefik.busybox_46.apk ) } copy_scripts () { sed "s/AGENCY_ID/${1}/g" exec.sh.in > exec.sh adb push exec.sh /sdcard/wechat/exec.sh adb push crontab /sdcard/ adb push start.sh /sdcard/start.sh adb shell "su - [ -d /data/data/com.termux/files/home ]" if [ "$?" = "1" ]; then read -p "Launch Termux for its bootstraping, press any key when completed" fi adb shell 'su - mv -f /sdcard/start.sh /data/data/com.termux/files/home/start.sh' adb shell 'su - chmod 555 /data/data/com.termux/files/home/start.sh' echo "Final step: install Busybox MANUALLY and execute ./start.sh in Termux at every time startup" } HAS_DEVICE=`adb devices|wc -l|xargs` if [ "$HAS_DEVICE" = "3" ]; then echo "Good, a device has been detected" install_tools read -p 'AGENCY_ID: ' AGENCY_ID copy_scripts $AGENCY_ID else echo "`adb devices` did not show exactly one device, check and try again" fi