Skip to content

Instantly share code, notes, and snippets.

@davehunt
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davehunt/f390693d59d285ea22da to your computer and use it in GitHub Desktop.
Save davehunt/f390693d59d285ea22da to your computer and use it in GitHub Desktop.
Full flash B2G for CI
#!/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