Last active
August 29, 2015 14:01
-
-
Save davehunt/f390693d59d285ea22da to your computer and use it in GitHub Desktop.
Full flash B2G for CI
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 -e | |
# This script is maintained at: | |
# https://gist.github.com/davehunt/f390693d59d285ea22da | |
# Preconditions: | |
# 1. device.zip and sources.xml must be present for this script to work | |
# 2. the device also has to be oem unlocked so we have fastboot mode | |
function show_free_space() { | |
echo -e "\n\033[1mShowing free space\033[0m" | |
adb shell df | |
} | |
function show_version() { | |
echo -e "\n\033[1mShowing version details\033[0m" | |
VIRTUALENV=mozversion_temp | |
virtualenv -q $VIRTUALENV | |
source $VIRTUALENV/bin/activate | |
pip install mozversion -q | |
set +e | |
mozversion --sources=sources.xml | |
set -e | |
deactivate | |
} | |
function flash() { | |
echo -e "\n\033[1mFlashing\033[0m" | |
B2G_DIR=flash_temp | |
rm -rf $B2G_DIR && mkdir $B2G_DIR | |
unzip -q device.zip -d $B2G_DIR | |
adb reboot bootloader && sleep 10 | |
fastboot flash boot $B2G_DIR/b2g-distro/out/target/product/*/boot.img | |
fastboot flash system $B2G_DIR/b2g-distro/out/target/product/*/system.img | |
fastboot flash userdata $B2G_DIR/b2g-distro/out/target/product/*/userdata.img | |
fastboot flash recovery $B2G_DIR/b2g-distro/out/target/product/*/recovery.img | |
fastboot reboot | |
} | |
show_free_space | |
flash | |
sleep 60 | |
show_free_space | |
show_version | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment