adb-channel (470B)
1 #!/bin/sh 2 3 set -e 4 5 t=`mktemp -d -t adb-channel.XXXXXX` 6 7 remote=${1} 8 activity=${2} 9 delay=${3} 10 11 atexit() { 12 [ -z "${activity}" ] || adb shell am force-stop ${activity%%/*} 13 adb forward --remove localfilesystem:"${t}/sock" 14 rm -rf "${t}" 15 } 16 trap atexit EXIT 17 trap 'exit 0' HUP INT ALRM TERM 18 19 [ -z "${activity}" ] || adb shell -n am start -W ${activity} 20 [ -z "${delay}" ] || sleep "${delay}" 21 adb forward localfilesystem:"${t}/sock" "${remote}" 22 socat stdio unix:"${t}/sock"