#!/bin/sh
###################################################################### 
#Copyright (C) 2019  Kris Occhipinti
#https://filmsbykris.com

#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.
###################################################################### 

#Motorola Moto G 2014 flash all stock images

fastboot flash partition gpt.bin
fastboot reboot-bootloader

sleep 5

echo "FLASHING BOOTLOADER..."
fastboot flash motoboot motoboot.img

echo "FLASHING LOGO..."
fastboot flash logo logo.bin

echo "FLASHING BOOT IMG..."
fastboot flash boot boot.img

echo "FLASHING RECOVERY IMG..."
fastboot flash recovery recovery.img

echo "FLASHING SYSTEM IMG..."
fastboot flash system system.img_sparsechunk.0                                                  
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3

echo "FLASHING MODEM..."
fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn

echo "ERASING CACHE..."
fastboot erase cache

echo "REBOOTING..."
fastboot reboot