Created
May 16, 2013 21:12
-
-
Save anonymous/5595148 to your computer and use it in GitHub Desktop.
A short script to perform auto install on multiple Android devices by watching a specific folder for an .apk write. Usage: ./continuous_deploy.sh com.example.package/.MainActivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
folder="bin/classes/" | |
package="$1" | |
inotifywait -m -q -e close_write "$folder" | while read f; do | |
# take only the filename | |
f=`awk '{print $3}' <<< "$f"` | |
# rebuild the full path | |
path="$folder$f" | |
# if it's not an apk or is the unaligned one, skip it | |
if [[ $f =~ ^.*unaligned\.apk$ || ! $f =~ ^.*apk$ ]]; then | |
echo "Skipping $f" | |
continue; | |
fi | |
# Get the list of device names. This ignores whether they're online or not. | |
devices=`adb devices | sed '1d' | awk '{print $1;}'` | |
echo "Sending $f.." | |
echo "$devices" | (parallel adb -s {} install -r "$path" | sed 's/^/ /') 2> /dev/null | |
echo "done" | |
# If we provided an activity name, start it on all devices | |
if [ $package ]; then | |
echo "Starting activity $package.." | |
echo "$devices" | (parallel adb -s {} shell am start "$package" | sed 's/^/ /') 2> /dev/null | |
echo "done" | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment