install.sh 1017 B

123456789101112131415161718192021222324252627282930
  1. # install tools
  2. install_tools () {
  3. echo "Installing tools, you MAY grant the operation by click the button..."
  4. sleep 2
  5. set -e
  6. (
  7. set -x
  8. adb install -r apk/Termux_v0.118.0_apkpure.com.apk
  9. adb install -r apk/ru.meefik.busybox_46.apk
  10. )
  11. }
  12. copy_scripts () {
  13. echo $1
  14. sed "s/AGENCY_ID/${1}/g" exec.sh.in > exec.sh
  15. adb push exec.sh /sdcard/wechat/exec.sh
  16. adb push crontab /sdcard/
  17. adb push start.sh /sdcard/start.sh
  18. adb shell 'su - mv -f /sdcard/start.sh /data/data/com.termux/files/home/start.sh'
  19. adb shell 'su - chmod 555 /data/data/com.termux/files/home/start.sh'
  20. echo "Final step: install Busybox MANUALLY and execute ./start.sh in Termux at every time startup"
  21. }
  22. HAS_DEVICE=`adb devices|wc -l|xargs`
  23. if [ "$HAS_DEVICE" = "3" ]; then
  24. echo "Good, a device has been detected"
  25. install_tools
  26. read -p 'AGENCY_ID: ' AGENCY_ID
  27. copy_scripts $AGENCY_ID
  28. else
  29. echo "`adb devices` did not show exactly one device, check and try again"
  30. fi