-
-
Save adduc/0a71471f4b5c75aba57f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
if test $# -lt 1 ; then | |
echo "Usage: download_apk.sh <target-dir>" | |
exit 1 | |
fi | |
for LINE in $(adb shell pm list packages -f -3|sed 's/package://g'); do | |
APK_PATH=$(echo "$LINE" | cut -d'=' -f1) | |
FILE=$1/$(echo "${LINE}" | cut -d'=' -f2 | sed 's/\r$//').apk | |
if [ -f "$FILE" ]; then | |
DEVICE=$(adb shell md5sum $APK_PATH | cut -d' ' -f1) | |
LOCAL=$(md5sum $FILE | cut -d' ' -f1) | |
if [ "$DEVICE" = "$LOCAL" ]; then | |
echo "Skipping $FILE, already have locally." | |
continue | |
fi | |
fi | |
echo "Pulling $APK_PATH to $FILE ..." | |
adb pull $APK_PATH $FILE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment