Created
September 27, 2014 09:09
-
-
Save gpoole/031a10957e3d910a7c01 to your computer and use it in GitHub Desktop.
Install CyanogenMod updates on an encrypted Nexus 5
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
#!/bin/bash | |
if [ -z "$1" ]; then | |
read -p "No file specified, would you like to download the latest version? (Y/n)" PROMPT | |
if [ "$PROMPT" == "n" ]; then | |
echo "Will not download update." | |
exit | |
fi | |
URL="http://download.cyanogenmod.org`curl -L http://download.cyanogenmod.org/\?type\=snapshot\&device\=hammerhead 2>/dev/null | perl -wlne 'print $1 if /<a href="(\/get\/jenkins\/\d+\/[^"]+\.zip)">/i' | head -n1`" | |
FILENAME=`basename $URL` | |
echo "Downloading $URL" | |
curl -L "$URL" > "$FILENAME" | |
else | |
FILENAME="$1" | |
fi | |
if ! [ -f $FILENAME ]; then | |
echo "The update file ($FILENAME) couldn't be found..." | |
exit 1 | |
fi | |
echo "Rebooting phone into recovery!" | |
adb reboot recovery | |
echo "Waiting for device to come back online..." | |
while ! adb shell "echo test" 2>/dev/null 1>/dev/null; do | |
sleep 1 | |
done | |
adb shell "mount -t tmpfs none /data" | |
adb shell "mkdir /data/media" | |
echo "Pushing update..." | |
adb push $FILENAME /sdcard/ | |
echo "Now install the update from the rom manager menus." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment