|
|
@@ -7,13 +7,28 @@ install_tools () {
|
|
|
set -x
|
|
|
adb install -r apk/Termux_v0.118.0_apkpure.com.apk
|
|
|
adb install -r apk/ru.meefik.busybox_46.apk
|
|
|
+ adb install -r apk/com.termux.boot_7.apk
|
|
|
)
|
|
|
}
|
|
|
+setup_auto_boot () {
|
|
|
+ echo "Setup experimental Termux:boot for auto-start"
|
|
|
+ set -e
|
|
|
+ (
|
|
|
+ set -x
|
|
|
+ TX_UID=`adb shell su - stat -c "%U" /data/data/com.termux/files/home|xargs`
|
|
|
+ adb shell 'su - mkdir -p /data/data/com.termux/files/home/.termux/boot/'
|
|
|
+ adb shell 'su - mv -f /sdcard/crond.sh /data/data/com.termux/files/home/.termux/boot/'
|
|
|
+ adb shell 'su - chmod 555 /data/data/com.termux/files/home/.termux/boot/crond.sh'
|
|
|
+ adb shell "su - chown -R ${TX_UID}:${TX_UID} /data/data/com.termux/files/home/.termux/boot"
|
|
|
+ )
|
|
|
+ echo "Success, launch Termux:boot once to activiate it."
|
|
|
+}
|
|
|
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 push start_fg.sh /sdcard/crond.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"
|
|
|
@@ -21,6 +36,7 @@ copy_scripts () {
|
|
|
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"
|
|
|
+ setup_auto_boot
|
|
|
}
|
|
|
HAS_DEVICE=`adb devices|wc -l|xargs`
|
|
|
if [ "$HAS_DEVICE" = "3" ]; then
|