xwords/xwords4/android/scripts/install-all.sh

72 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/sh
2012-01-21 08:50:12 -08:00
set -u -e
usage() {
[ $# -ge 1 ] && echo "Error: $1"
2012-07-01 12:53:36 -07:00
echo "usage: $(basename $0) [-e|-d] [-p /path/to/.apk]"
2012-01-21 08:50:12 -08:00
exit 1
}
if [ ! -e build.xml ]; then
usage "No build.xml; please run me from the top android directory"
fi
APK=./bin/XWords4-debug.apk
DIRNAME=$(basename $(pwd))
case $DIRNAME in
XWords4-bt)
PKG=xw4bt
;;
XWords4)
PKG=xw4
;;
*)
usage "running in unexpected directory $DIRNAME"
;;
esac
2013-11-10 09:01:52 -08:00
DEVICES=''
2012-01-21 08:50:12 -08:00
while [ $# -ge 1 ]; do
case $1 in
-e)
2013-11-10 09:01:52 -08:00
DEV="$(adb devices | grep '^emulator' | awk '{print $1}')"
DEVICES="$DEVICES $DEV"
2012-01-21 08:50:12 -08:00
;;
-d)
2013-11-10 09:01:52 -08:00
DEV="$(adb devices | grep -v emulator | grep 'device$' | awk '{print $1}')"
DEVICES="$DEVICES $DEV"
2012-01-21 08:50:12 -08:00
;;
2012-02-22 13:01:00 -08:00
-p)
[ $# -gt 1 ] || usage "-p requires an argument"
shift
APK=$1
;;
2012-01-21 08:50:12 -08:00
*)
usage
;;
esac
shift
done
[ -e $APK ] || usage "$APK not found"
2012-01-21 08:50:12 -08:00
if [ -n "$DEVICES" ]; then
echo "installing this binary. Check the age..."
ls -l $APK
echo ""
fi
COUNT=0
for DEVICE in $DEVICES; do
echo $DEVICE
adb -s $DEVICE install -r $APK
2013-12-03 08:26:26 -08:00
adb -s $DEVICE shell am start \
-n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.GamesList
COUNT=$((COUNT+1))
done
2012-01-21 08:50:12 -08:00
echo "installed into $COUNT devices/emulators"