Skip to content

Instantly share code, notes, and snippets.

@sethbergman
Forked from olesenm/helium-desktop.sh
Created January 24, 2017 13:05
Show Gist options
  • Save sethbergman/43b57bc6dd047173b6d2bf6b56fa01ab to your computer and use it in GitHub Desktop.
Save sethbergman/43b57bc6dd047173b6d2bf6b56fa01ab to your computer and use it in GitHub Desktop.
helium shell script with normal system locations for 'adb'
#!/bin/sh
# start helium server on android device - see http://www.clockworkmod.com/carbon for more details
# set -x
# try normal system locations before the local binary
unset adb
for i in /usr/bin /usr/local/bin "$(/usr/bin/dirname $0)"
do
i="$i/adb"
if [ -f "$i" -a -x "$i" ]
then
adb=$i
break
fi
done
if [ -e "$adb" ]
then
echo "using adb: $adb" 1>&2
else
echo "could not resolve a path to adb ... check your installation" 1>&2
exit 1
fi
# "pm path" returns somthing like the following
# "package:/data/app/com.koushikdutta.backup-1.apk\r"
# but with a trailing carriage return that screws up the class name in dalvikvm invocation
#
echo "retrieving the class name ..." 1>&2
pkg=$($adb shell pm path com.koushikdutta.backup | /usr/bin/sed -e 's/^.*://' -e 's/\r//')
echo "starting up helium package '$pkg'" 1>&2
$adb shell << EOF
CLASSPATH=$pkg app_process /system/bin com.koushikdutta.shellproxy.ShellRunner2 $@ &
exit
EOF
# end-of-file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment