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