-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1by1.sh
More file actions
executable file
·61 lines (45 loc) · 1.45 KB
/
1by1.sh
File metadata and controls
executable file
·61 lines (45 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -x
# Script to flash the Nexus 6 from a factory image
# https://developers.google.com/android/nexus/images
# TWRP
# https://dl.twrp.me/shamu/
if [ -z ${1} ]; then
echo "ERROR: Please specify image.tgz as parameter!"
exit 1
fi
# Image name is always the first part of the filename (device-version) before "-factory....tgz"
IMG="${1//-factory*/}"
# Device name is first part of string up to first "-", remove from the end
DEVICE="${IMG%-*}"
# Version is 6 chars long, remove from the beginning
VERSION="${IMG#*-}"
# Unzip/Untar bundle
tar zxvf ${1} -k
# Unzip image
unzip -n -d $IMG $IMG/image-$IMG.zip
adb reboot bootloader
cd ${IMG}
bootloader=$(ls bootloader-${DEVICE}*.img)
radio=$(ls radio-${DEVICE}*.img)
fastboot flash bootloader ${bootloader}
fastboot reboot-bootloader
sleep 5
fastboot flash radio ${radio}
fastboot reboot-bootloader
sleep 5
fastboot flash boot boot.img
fastboot erase cache
fastboot flash cache cache.img
fastboot flash system system.img
# Flash recovery because it always break
fastboot flash recovery twrp-3.0.2-0-shamu.img
# Would need to find a way to install SuperSU here, maybe sideloading the zip and then issuing a TWRP command?
#reboot?
fastboot reboot
cd ..
# Need to do clean-up
# Need to test if this can be done immediately after flashing system, without reboot
#fastboot flash recovery twrp-3.0.2-0-shamu.img
# Also need to check how to install SuperSU from here
#http://forum.xda-developers.com/apps/supersu