[script][flash_all] Add wipe option

This commit is contained in:
Mathieu Maret 2016-02-18 15:45:22 +01:00
parent aa684f1763
commit 5d942bc74b

View File

@ -1,5 +1,6 @@
#!/bin/bash
haveSerial=false
shouldWipe=false
serial=""
used_serial=""
forbidden_serials="b06474cb"
@ -81,12 +82,15 @@ function check_presence {
fi
}
while getopts ":s:" opt; do
while getopts ":s:w" opt; do
case $opt in
s) echo "Using Serial $OPTARG"
serial=$OPTARG
haveSerial=true
;;
w)
shouldWipe=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
@ -120,6 +124,9 @@ else
for img in $imgList; do
imageName=$(basename $img)
imageName=${imageName%.img}
echo "fastboot -s $used_serial -S 256M flash ${imageName} $img;"
fastboot -s $used_serial -S 256M flash ${imageName} $img;
if $shouldWipe; then
fastboot -s $used_serial -w
fi
done && fastboot reboot
fi