xwords/xwords4/android/scripts/install_all.sh

52 lines
1,000 B
Bash
Raw Normal View History

#!/bin/sh
2012-01-21 17:50:12 +01:00
set -u -e
APK=./bin/XWords4-debug.apk
usage() {
[ $# -ge 1 ] && echo "Error: $1"
2012-07-01 21:53:36 +02:00
echo "usage: $(basename $0) [-e|-d] [-p /path/to/.apk]"
2012-01-21 17:50:12 +01:00
exit 1
}
2012-07-01 21:53:36 +02:00
DEVICES="$(adb devices | grep 'device$' | awk '{print $1}')"
2012-01-21 17:50:12 +01:00
while [ $# -ge 1 ]; do
case $1 in
-e)
DEVICES="$(adb devices | grep '^emulator' | awk '{print $1}')"
2012-01-21 17:50:12 +01:00
;;
-d)
DEVICES="$(adb devices | grep -v emulator | grep 'device$' | awk '{print $1}')"
2012-01-21 17:50:12 +01:00
;;
2012-02-22 22:01:00 +01:00
-p)
[ $# -gt 1 ] || usage "-p requires an argument"
shift
APK=$1
;;
2012-01-21 17:50:12 +01:00
*)
usage
;;
esac
shift
done
[ -e $APK ] || usage "$APK not found"
2012-01-21 17:50:12 +01: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
COUNT=$((COUNT+1))
done
2012-01-21 17:50:12 +01:00
echo "installed into $COUNT devices/emulators"