forked from askeing/B2G-flash-tool
-
Notifications
You must be signed in to change notification settings - Fork 1
/
auto_flash_from_twci.sh
executable file
·655 lines (585 loc) · 19.9 KB
/
auto_flash_from_twci.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
#!/bin/bash
#==========================================================================
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#==========================================================================
#
# IMPORTANT: internal tool
#
# Description:
# This script was written for download builds from TW-CI server.
#
# Author: Askeing fyen@mozilla.com
# History:
# 2013/08/13 Askeing: v1.0 First release.
# 2013/08/14 Askeing: v1.1 Interaction GUI mode.
# 2013/10/11 Askeing: updated -f|--flash to -f|--full.
# 2013/11/13 Askeing: if flash gecko, then un-install com-ril. set KEEP_COMRIL=1 will skip this step.
# 2013/11/13 Askeing: removed KEEP_COMRIL, set UNINSTALL_COMRIL=true to un-install com-ril.
#
#==========================================================================
####################
# Parameter Flags #
####################
VERY_SURE=false
INTERACTION_WINDOW=false
ADB_DEVICE="Device"
DEVICE_NAME=""
VERSION_NAME=""
FLASH_FULL=false
FLASH_GAIA=false
FLASH_GECKO=false
FLASH_FULL_IMG_FILE=""
FLASH_GAIA_FILE=""
FLASH_GECKO_FILE=""
TARGET_ID=-1
####################
# Functions #
####################
## Show usage
function helper(){
echo -e "This script was written for download builds from TW-CI server.\n"
echo -e "Usage: ./auto_flash_from_twci.sh [parameters]"
echo -e " -v|--version\tthe target build version."
echo -e " -d|--device\tthe target device."
echo -e " -s <serial number>\tdirects command to device with the given serial number."
echo -e " -f|--full\tflash full image into device."
echo -e " -g|--gaia\tshallow flash gaia into device."
echo -e " -G|--gecko\tshallow flash gecko into device."
echo -e " -w\t\tinteraction GUI mode."
echo -e " -y\t\tAssume \"yes\" to all questions"
echo -e " -h|--help\tdisplay help."
echo -e "Environment:"
echo -e " UNINSTALL_COMRIL=true \tuninstall the com-ril when shallow flash gecko. (Keep com-ril by default)"
echo -e "Example:"
echo -e " Flash by interaction GUI mode\t\t./auto_flash_from_twci.sh -w"
case `uname` in
"Linux")
echo -e " Flash wasabi v1.2.0 image\t\t./auto_flash_from_twci.sh -vv1.2.0 -dwasabi -f"
echo -e " Flash nexus4 master gaia/gecko\t./auto_flash_from_twci.sh --version=master --device=nexus4 -g -G";;
"Darwin")
echo -e " Flash wasabi v1.2.0 image\t\t./auto_flash_from_twci.sh -v v1.2.0 -d wasabi -f"
echo -e " Flash nexus4 master gaia/gecko\t./auto_flash_from_twci.sh --version master --device nexus4 --gaia --gecko";;
esac
exit 0
}
## Show the available version info
function version_info(){
echo -e "Available version:"
echo -e " 130|v1.3.0"
echo -e " 120|v1.2.0"
echo -e " 110hd|v1.1.0hd"
# echo -e " 110|v1train"
# echo -e " 101|v1.0.1"
echo -e " 0|master"
}
## Select the version
function version() {
local_ver=$1
case "$local_ver" in
130|v1.3.0) VERSION_NAME="v1.3.0";;
120|v1.2.0) VERSION_NAME="v1.2.0";;
110hd|v1.1.0hd) VERSION_NAME="v1.1.0hd";;
# 110|v1train) VERSION_NAME="v1train";;
# 101|v1.0.1) VERSION_NAME="v101";;
0|master) VERSION_NAME="master";;
*) version_info; exit -1;;
esac
}
## Show the available device info
function device_info(){
print_list
echo -e "Available device:"
echo -e " unagi"
# echo -e " inari"
# echo -e " leo"
echo -e " hamachi"
echo -e " buri"
echo -e " helix"
echo -e " wasabi"
echo -e " flatfish"
echo -e " fugu"
echo -e " nexus4"
echo -e " openc"
}
## Select the device
function device() {
local_ver=$1
case "$local_ver" in
unagi) DEVICE_NAME="unagi";;
# inari) DEVICE_NAME="inari";;
# leo) DEVICE_NAME="leo";;
hamachi) DEVICE_NAME="hamachi";;
buri) DEVICE_NAME="hamachi";;
helix) DEVICE_NAME="helix";;
wasabi) DEVICE_NAME="wasabi";;
flatfish) DEVICE_NAME="flatfish";;
fugu) DEVICE_NAME="fugu";;
nexus4) DEVICE_NAME="nexus4";;
openc) DEVICE_NAME="openC";;
*) device_info; exit -1;;
esac
}
## adb with flags
function run_adb()
{
# TODO: Bug 875534 - Unable to direct ADB forward command to inari devices due to colon (:) in serial ID
# If there is colon in serial number, this script will have some warning message.
adb $ADB_FLAGS $@
}
## install dialog package for interaction GUI mode
function check_install_dialog() {
if ! which dialog > /dev/null; then
read -p "Package \"dialog\" not found! Install? [Y/n]" REPLY
test "$REPLY" == "n" || test "$REPLY" == "N" && echo "byebye." && exit 0
sudo apt-get install dialog
fi
}
## Create the message for make sure dialog
function create_make_sure_msg() {
MAKE_SURE_MSG="\n"
MAKE_SURE_MSG+="Your Target Build: ${TARGET_NAME}\n"
MAKE_SURE_MSG+=" Rev Info: ${TARGET_DESC}\n"
MAKE_SURE_MSG+=" Flash: "
if [ ${FLASH_FULL} == true ]; then
MAKE_SURE_MSG+="Full Image."
else
if [ ${FLASH_GAIA} == true ]; then
MAKE_SURE_MSG+="Gaia, "
fi
if [ ${FLASH_GECKO} == true ]; then
MAKE_SURE_MSG+="Gecko, "
fi
fi
}
## make sure user want to flash/shallow flash
function make_sure() {
read -p "Are you sure you want to flash your device? [y/N]" isFlash
test "$isFlash" != "y" && test "$isFlash" != "Y" && echo "byebye." && exit 0
}
function make_sure_dialog() {
case `uname` in
"Linux")
create_make_sure_msg
MAKE_SURE_MSG+="\n\n\nAre you sure you want to flash your device?"
dialog --backtitle "Confirm the Information " --title "Confirmation" --yesno "${MAKE_SURE_MSG}" 18 55 2>${TMP_DIR}/menuitem_makesure
ret=$?
if [ ${ret} == 1 ]; then
echo "" && echo "byebye." && exit 0
fi;;
"Darwin")
ret=$(osascript -e 'tell application "Terminal" to display dialog "Do you want to flash your device?" with title "Check Message"')
esac
}
## Download the download list
function download_list() {
CONFIG_FILE=.auto_flash_from_TWCI.conf
if [ -f $CONFIG_FILE ]; then
. $CONFIG_FILE
else
echo "Can NOT found the config file: $CONFIG_FILE"
exit -1
fi
TWCI_DL_LIST=.TWCI_DL_LIST.conf
rm -f ${TWCI_DL_LIST}
echo "Updating DL List from TWCI..."
wget -q $TWCI_DL_LIST_URL
if [ -f $TWCI_DL_LIST ]; then
. $TWCI_DL_LIST
else
echo "Cannot download the ${TWCI_DL_LIST} file from ${TWCI_DL_LIST_URL}"
exit -1
fi
}
## Print download list
function print_list() {
echo "Available Builds:"
for (( COUNT=0 ; COUNT<${DL_SIZE} ; COUNT++ ))
do
KEY=DL_${COUNT}_JOB_NAME
eval VALUE=\$$KEY
echo -e " ${COUNT}) ${VALUE}"
done
}
## Select build
function select_build() {
print_list
while [[ ${TARGET_ID} -lt 0 ]] || [[ ${TARGET_ID} -gt ${DL_SIZE} ]]; do
read -p "What do you want to flash into your device? [Q to exit]" TARGET_ID
test ${TARGET_ID} == "q" || test ${TARGET_ID} == "Q" && echo "byebye." && exit 0
done
}
function select_build_dialog() {
case `uname` in
"Linux")
MENU_FLAG=""
for (( COUNT=0 ; COUNT<${DL_SIZE} ; COUNT++ ))
do
KEY=DL_${COUNT}_JOB_NAME
eval VALUE=\$$KEY
echo -e "${COUNT}) ${VALUE}"
MENU_FLAG+=" ${COUNT} \"${VALUE}\""
done
dialog --backtitle "Select Build from TW-CI Server " --title "Download List" --menu "Move using [UP] [DOWN],[Enter] to Select" \
18 55 10 ${MENU_FLAG} 2>${TMP_DIR}/menuitem_build
ret=$?
if [ ${ret} == 1 ]; then
echo "" && echo "byebye." && exit 0
fi
menuitem_build=`cat ${TMP_DIR}/menuitem_build`
case $menuitem_build in
"") echo ""; echo "byebye."; exit 0;;
*) TARGET_ID=$menuitem_build;;
esac;;
"Darwin")
option_list=""
for (( COUNT=0 ; COUNT<${DL_SIZE} ; COUNT++ ))
do
KEY=DL_${COUNT}_JOB_NAME
eval VALUE=\$$KEY
option_list=$option_list,\"${COUNT}-${VALUE}\"
done
local_option_list=${option_list#,*}
eval ret=\$\(osascript -e \'tell application \"Terminal\" to choose from list \{$local_option_list\} with title \"Select Build\"\'\)
echo $ret
TARGET_ID=${ret%%-*};;
esac
}
## Print flash mode
function print_flash_mode() {
echo "Flash Mode:"
echo " 1) Shallow flash Gaia/Gecko"
echo " 2) Shallow flash Gaia"
echo " 3) Shallow flash Gecko"
echo " 4) Flash Full Image"
}
## Select flash mode
function select_flash_mode() {
# if there are no flash flag, then ask
while [ ${FLASH_FULL} == false ] && [ ${FLASH_GAIA} == false ] && [ ${FLASH_GECKO} == false ]; do
print_flash_mode
read -p "What do you want to flash? [Q to exit]" FLASH_INPUT
test ${FLASH_INPUT} == "q" || test ${FLASH_INPUT} == "Q" && echo "byebye." && exit 0
case $FLASH_INPUT in
1) FLASH_GAIA=true; FLASH_GECKO=true;;
2) FLASH_GAIA=true;;
3) FLASH_GECKO=true;;
4) FLASH_FULL=true;;
esac
done
}
function select_flash_mode_dialog() {
case `uname` in
"Linux")
# if there are no flash flag, then ask
if [ ${FLASH_FULL} == false ] && [ ${FLASH_GAIA} == false ] && [ ${FLASH_GECKO} == false ]; then
dialog --backtitle "Select Build from TW-CI Server " --title "Flash Mode" --menu "Move using [UP] [DOWN],[Enter] to Select" \
18 55 10 1 "Shallow flash Gaia/Gecko" 2 "Shallow flash Gaia" 3 "Shallow flash Gecko" 4 "Flash Full Image" 2>${TMP_DIR}/menuitem_flash
ret=$?
if [ ${ret} == 1 ]; then
echo "" && echo "byebye." && exit 0
fi
menuitem_flash=`cat ${TMP_DIR}/menuitem_flash`
case $menuitem_flash in
"") echo ""; echo "byebye."; exit 0;;
1) FLASH_GAIA=true; FLASH_GECKO=true;;
2) FLASH_GAIA=true;;
3) FLASH_GECKO=true;;
4) FLASH_FULL=true;;
esac
fi;;
"Darwin")
ret=$(osascript -e 'tell application "Terminal" to choose from list {"1-Flash Gaia and Gecko", "2-Flash Gaia", "3-Flash Gecko", "4-Flash Full Image"}')
echo $ret
case ${ret%%-*} in
"") echo ""; echo "byebye."; exit 0;;
1) FLASH_GAIA=true; FLASH_GECKO=true;;
2) FLASH_GAIA=true;;
3) FLASH_GECKO=true;;
4) FLASH_FULL=true;;
esac;;
esac
}
## Find the download build's info
function find_download_files_name() {
TARGET_NAME_KEY=DL_${TARGET_ID}_JOB_NAME
eval TARGET_NAME=\$$TARGET_NAME_KEY
TARGET_DESC_KEY=DL_${TARGET_ID}_DESC
eval TARGET_DESC=\$$TARGET_DESC_KEY
TARGET_URL_KEY=DL_${TARGET_ID}_URL
eval TARGET_URL=\$$TARGET_URL_KEY
TARGET_IMG_KEY=DL_${TARGET_ID}_ARTIFACT_B2G_IMG
eval TARGET_IMG=\$$TARGET_IMG_KEY
TARGET_GAIA_KEY=DL_${TARGET_ID}_ARTIFACT_GAIA
eval TARGET_GAIA=\$$TARGET_GAIA_KEY
TARGET_GECKO_KEY=DL_${TARGET_ID}_ARTIFACT_GECKO
eval TARGET_GECKO=\$$TARGET_GECKO_KEY
}
## Print flash info
function print_flash_info() {
echo "Your Target Build: ${TARGET_NAME}"
echo " Rev Info: ${TARGET_DESC}"
echo -n " Flash: "
if [ ${FLASH_FULL} == true ]; then
echo -n "Full Image."
else
if [ ${FLASH_GAIA} == true ]; then
echo -n "Gaia, "
fi
if [ ${FLASH_GECKO} == true ]; then
echo -n "Gecko, "
fi
fi
echo ""
}
function print_flash_info_dialog() {
create_make_sure_msg
if [ -e ./check_versions.sh ]; then
MAKE_SURE_MSG+="\n\n"
MAKE_SURE_MSG+=`bash ./check_versions.sh | sed ':a;N;$!ba;s/\n/\\\n/g'`
fi
case `uname` in
"Linux")
dialog --backtitle "Flash Information " --title "Done" --msgbox "${MAKE_SURE_MSG}" 15 55 2>${TMP_DIR}/menuitem_done ;;
esac
}
function downlaod_file_from_TWCI() {
DL_URL=$1
DL_FILE=$2
DEST_DIR=$3
echo ""
echo "Download file: ${DL_URL}artifact/${DL_FILE}"
wget -P ${DEST_DIR} ${DL_URL}artifact/${DL_FILE}
}
## Shallow flash gaia/gecko
function do_shallow_flash() {
SHALLOW_FLAG+=$ADB_FLAGS
if [ ${FLASH_GAIA} == true ]; then
if [[ ${TARGET_GAIA} == "" ]]; then
echo "No Gaia file at ${TARGET_URL}" && exit 0
fi
downlaod_file_from_TWCI ${TARGET_URL} ${TARGET_GAIA} ${TMP_DIR}
GAIA_BASENAME=`basename ${TMP_DIR}/${TARGET_GAIA}`
case `uname` in
"Linux") SHALLOW_FLAG+=" -g${TMP_DIR}/${GAIA_BASENAME}";;
"Darwin") SHALLOW_FLAG+=" -g ${TMP_DIR}/${GAIA_BASENAME}";;
esac
fi
if [ ${FLASH_GECKO} == true ]; then
if [[ ${TARGET_GECKO} == "" ]]; then
echo "No Gecko file at ${TARGET_URL}" && exit 0
fi
downlaod_file_from_TWCI ${TARGET_URL} ${TARGET_GECKO} ${TMP_DIR}
GECKO_BASENAME=`basename ${TMP_DIR}/${TARGET_GECKO}`
case `uname` in
"Linux") SHALLOW_FLAG+=" -G${TMP_DIR}/${GECKO_BASENAME}";;
"Darwin") SHALLOW_FLAG+=" -G ${TMP_DIR}/${GECKO_BASENAME}";;
esac
## if flash gecko and UNINSTALL_COMRIL=true, then un-install com-ril.
if [ -e ./uninstall_comril.sh ] && [[ ${UNINSTALL_COMRIL} == true ]]; then
echo "Un-install com-ril..."
bash ./uninstall_comril.sh -u -y
fi
fi
SHALLOW_FLAG+=" -y"
if [ -e ./shallow_flash.sh ]; then
echo "./shallow_flash.sh ${SHALLOW_FLAG}"
bash ./shallow_flash.sh ${SHALLOW_FLAG}
ret=$?
if ! [ ${ret} == 0 ]; then
echo "Shallow Flash failed."
exit -1
fi
else
echo -e "There is no shallow_flash.sh in your folder."
fi
}
## Flash full image
function do_flash_image() {
if [[ ${TARGET_IMG} == "" ]]; then
echo "No full image file at ${TARGET_URL}" && exit 0
fi
downlaod_file_from_TWCI ${TARGET_URL} ${TARGET_IMG} ${TMP_DIR}
IMG_BASENAME=`basename ${TMP_DIR}/${TARGET_IMG}`
unzip -d ${TMP_DIR} ${TMP_DIR}/${IMG_BASENAME}
CURRENT_DIR=`pwd`
cd ${TMP_DIR}/b2g-distro/
## if no DEVICE_NAME (GUI mode), then find the DEVICE_NAME from TARGET_NAME
if [[ ${DEVICE_NAME} == "" ]]; then
IFS="." read -a TEMP_NAMES <<< "${TARGET_NAME}"
TEMP_NAMES_SIZE=${#TEMP_NAMES[@]}
let TEMP_NAMES_INDEX=${TEMP_NAMES_SIZE}-1
TEMP_NAMES_KEY=TEMP_NAMES[${TEMP_NAMES_INDEX}]
eval DEVICE_NAME=\${$TEMP_NAMES_KEY}
fi
## flash flatfish device
if [[ ${DEVICE_NAME} == "flatfish" ]]; then
echo "Flash by flash_flatfish.sh script..."
bash ./flash_flatfish.sh
## flash other devices
else
bash ./flash.sh -f
fi
ret=$?
if ! [ ${ret} == 0 ]; then
echo "Flash image failed."
exit -1
fi
cd ${CURRENT_DIR}
}
#########################
# Create TEMP Folder #
#########################
if ! which mktemp > /dev/null; then
echo "Package \"mktemp\" not found!"
rm -rf ./autoflashfromTWCI_temp
mkdir autoflashfromTWCI_temp
cd autoflashfromTWCI_temp
TMP_DIR=`pwd`
cd ..
else
rm -rf /tmp/autoflashfromTWCI.*
TMP_DIR=`mktemp -d -t autoflashfromTWCI.XXXXXXXXXXXX`
fi
#########################
# Download TWCI List #
#########################
download_list
#########################
# Processing Parameters #
#########################
## show helper if nothing specified
if [ $# = 0 ]; then echo "Nothing specified"; helper; exit 0; fi
## distinguish platform
case `uname` in
"Linux")
## add getopt argument parsing
TEMP=`getopt -o v::d::s::gGfwyh --long version::,device::,gaia,gecko,full,help \
-n 'invalid option' -- "$@"`
if [ $? != 0 ]; then echo "Try '--help' for more information." >&2; exit 1; fi
eval set -- "$TEMP";;
"Darwin");;
esac
while true
do
case "$1" in
-v|--version)
case "$2" in
"") version_info; exit 0; shift 2;;
*) version $2; shift 2;;
esac ;;
-d|--device)
case "$2" in
"") device_info; exit 0; shift 2;;
*) device $2; shift 2;;
esac ;;
-s)
case "$2" in
"") shift 2;;
*) ADB_DEVICE=$2; ADB_FLAGS+="-s $2"; shift 2;;
esac ;;
-f|--full) FLASH_FULL=true; shift;;
-g|--gaia) FLASH_GAIA=true; shift;;
-G|--gecko) FLASH_GECKO=true; shift;;
-w) INTERACTION_WINDOW=true; shift;;
-y) VERY_SURE=true; shift;;
-h|--help) helper; exit 0;;
--) shift;break;;
"") shift;break;;
*) helper; echo error occured; exit 1;;
esac
done
## Disable GUI mode for MAC OS X, issue #20 will reslove it.
# case `uname` in
# "Darwin") INTERACTION_WINDOW=false;;
# esac
##################################################
# For interaction GUI mode, check dialog package #
##################################################
if [ ${INTERACTION_WINDOW} == true ]; then
case `uname` in
"Linux") check_install_dialog;;
esac
fi
#############################################
# Find the B2G.${VERSION}.${DEVICE} in list #
#############################################
FOUND=false
TARGET_NAME=B2G.${VERSION_NAME}.${DEVICE_NAME}
for (( COUNT=0 ; COUNT<${DL_SIZE} ; COUNT++ ))
do
KEY=DL_${COUNT}_JOB_NAME
eval VALUE=\$$KEY
if [ ${TARGET_NAME} == ${VALUE} ]; then
echo "${TARGET_NAME} is found!!"
FOUND=true
TARGET_ID=${COUNT}
fi
done
##########################################################################################
# If can NOT find the target from user input parameters, list the download list to user. #
##########################################################################################
if [ ${FOUND} == false ]; then
echo "Can NOT found the ${TARGET_NAME}"
echo "Please select one build from following list."
if [ ${INTERACTION_WINDOW} == false ]; then
select_build
else
select_build_dialog
fi
fi
###################################################################################
# If can NOT find the flash mode from user input parameters, list the flash mode. #
###################################################################################
if [ ${INTERACTION_WINDOW} == false ]; then
select_flash_mode
else
select_flash_mode_dialog
fi
####################################
# Find the name of download files. #
####################################
find_download_files_name
if [ ${INTERACTION_WINDOW} == false ]; then
print_flash_info
if [ ${VERY_SURE} == false ]; then
make_sure
fi
else
if [ ${VERY_SURE} == false ]; then
make_sure_dialog
fi
fi
##################################
# Flash full image OR gaia/gecko #
##################################
if [ ${FLASH_FULL} == true ]; then
echo "Flash Full Image..."
do_flash_image
elif [ ${FLASH_GAIA} == true ] || [ ${FLASH_GECKO} == true ]; then
echo "Shallow Flash..."
do_shallow_flash
fi
####################
# Version #
####################
echo "================="
echo "Flash Information"
echo "================="
if [ ${INTERACTION_WINDOW} == false ]; then
print_flash_info
if [ -e ./check_versions.sh ]; then
bash ./check_versions.sh
fi
echo "Done."
else
case `uname` in
"Linux") print_flash_info_dialog;;
"Darwin") print_flash_info;;
esac
fi
#########################
# Remove Temp Folder #
#########################
rm -rf ${TMP_DIR}