mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
tweak scripts to have better default behavior
This commit is contained in:
parent
d536d05e24
commit
ff12cc6f91
2 changed files with 33 additions and 20 deletions
|
@ -1,10 +1,10 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
set -u -e
|
||||
|
||||
usage() {
|
||||
[ $# -ge 1 ] && echo "Error: $1"
|
||||
echo "usage: $(basename $0) [-e|-d] [-p /path/to/.apk]"
|
||||
echo "usage: $(basename $0) [-e|-d] (-p /path/to/.apk)+"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,11 @@ if [ ! -e build.xml ]; then
|
|||
usage "No build.xml; please run me from the top android directory"
|
||||
fi
|
||||
|
||||
APK=./bin/XWords4-debug.apk
|
||||
APKS=''
|
||||
DEVICES=''
|
||||
DIRNAME=$(basename $(pwd))
|
||||
ADB="$(which adb)"
|
||||
|
||||
case $DIRNAME in
|
||||
XWords4-dbg)
|
||||
PKG=xw4dbg
|
||||
|
@ -29,22 +32,20 @@ case $DIRNAME in
|
|||
;;
|
||||
esac
|
||||
|
||||
DEVICES=''
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
case $1 in
|
||||
-e)
|
||||
DEV="$(adb devices | grep '^emulator' | awk '{print $1}')"
|
||||
DEV="$($ADB devices | grep '^emulator' | awk '{print $1}')"
|
||||
DEVICES="$DEVICES $DEV"
|
||||
;;
|
||||
-d)
|
||||
DEV="$(adb devices | grep -v emulator | grep 'device$' | awk '{print $1}')"
|
||||
DEV="$($ADB devices | grep -v emulator | grep 'device$' | awk '{print $1}')"
|
||||
DEVICES="$DEVICES $DEV"
|
||||
;;
|
||||
-p)
|
||||
[ $# -gt 1 ] || usage "-p requires an argument"
|
||||
shift
|
||||
APK=$1
|
||||
APKS="$APKS $1"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
|
@ -53,22 +54,30 @@ while [ $# -ge 1 ]; do
|
|||
shift
|
||||
done
|
||||
|
||||
[ -e $APK ] || usage "$APK not found"
|
||||
if [ -z "$DEVICES" ]; then
|
||||
while read LINE; do
|
||||
if echo $LINE | grep -q "device$"; then
|
||||
DEVICE=$(echo $LINE | awk '{print $1}')
|
||||
DEVICES="$DEVICES $DEVICE"
|
||||
fi
|
||||
done <<< "$($ADB devices)"
|
||||
fi
|
||||
|
||||
if [ -n "$DEVICES" ]; then
|
||||
echo "installing this binary. Check the age..."
|
||||
ls -l $APK
|
||||
echo ""
|
||||
# If no apk specified, take the newest built
|
||||
if [ -z "$APKS" ]; then
|
||||
APKS=$(ls -t bin/*.apk | head -n 1)
|
||||
fi
|
||||
|
||||
COUNT=0
|
||||
|
||||
for DEVICE in $DEVICES; do
|
||||
echo $DEVICE
|
||||
adb -s $DEVICE install -r $APK
|
||||
adb -s $DEVICE shell am start \
|
||||
-n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.GamesListActivity
|
||||
COUNT=$((COUNT+1))
|
||||
for APK in $APKS; do
|
||||
echo "installing $APK; details:"
|
||||
ls -l $APK
|
||||
$ADB -s $DEVICE install -r $APK
|
||||
$ADB -s $DEVICE shell am start \
|
||||
-n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.GamesListActivity
|
||||
done
|
||||
COUNT=$((COUNT+1))
|
||||
done
|
||||
|
||||
echo "installed into $COUNT devices/emulators"
|
||||
|
|
|
@ -74,13 +74,17 @@ esac
|
|||
# generate local.properties
|
||||
[ -e local.properties ] || ../scripts/setup_local_props.sh
|
||||
|
||||
# If this fails, the "set -e" above means we won't try to install anything
|
||||
ant $CMDS
|
||||
|
||||
if [ -n "$UNINSTALL" ]; then
|
||||
uninstall
|
||||
fi
|
||||
|
||||
if [ -n "$INSTALL" ]; then
|
||||
adb-install.sh -e -d
|
||||
# Find the newest apk in this directory and install it
|
||||
APK=$(ls -t bin/*.apk | head -n 1)
|
||||
adb-install.sh -p $APK
|
||||
fi
|
||||
|
||||
# if [ "$CMDS" != "${CMDS%%install}" ]; then
|
||||
|
|
Loading…
Reference in a new issue