Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ "$1" == "" ]
- then
- echo "must specify a zip to flash"
- exit 0
- fi
- adb root
- sleep 3
- filename=`echo $1 | sed 's/^.*\///'`
- filesize=$( stat -c %s $filename )
- if [ "`adb devices | grep recovery | awk '{print $2}'`" == "recovery" ]
- then
- adb shell mount /data/
- fi
- targetdir="/data/media/"
- adb shell rm /data/media/$filename > /dev/null
- echo "Pushing $filename to $targetdir/$filename"
- coproc ADB_PUSH ( set +m
- adb push $1 $targetdir/$filename 2> /dev/null || \
- echo "Error: failed"
- set -m
- )
- until [ "$ADB_PUSH_PID" = "" ];do
- sleep 1
- adb shell stat -t $targetdir/$filename | \
- awk '{printf "\r[ %5.1f%% ] ( %s/%s )",($2/'$filesize')*100,$2/1024,'$filesize'/1024}'
- done
- echo ""
- if [ "`adb devices | grep recovery | awk '{print $2}'`" == "recovery" ]
- then
- adb shell umount /data/
- fi
- adb shell mount -o remount,rw /cache
- echo "install_zip(\"/data/media/$filename\");" > /tmp/recoveryscript
- adb push /tmp/recoveryscript /cache/recovery/extendedcommand
- echo "Done!"
- echo "Rebooting into recovery to flash!"
- adb reboot recovery
- rm /tmp/recoveryscript
Add Comment
Please, Sign In to add comment