[script][android] Add flash_all cmd + completion

This commit is contained in:
Mathieu Maret 2015-11-25 11:32:55 +01:00
parent cdf21d7d10
commit 2c78121c1e
2 changed files with 25 additions and 0 deletions

View File

@ -206,3 +206,11 @@ _sdocker () {
}
complete -o default -F _sdocker sdocker
_flash_all () {
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "$(ls *.img)" -- ${cur} ) )
}
complete -o default -F _flash_all flash_all

17
scripts/flash_all Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ $# -eq 0 ];
then
imgList=$(ls *.img)
echo "Flashing all images $imgList"
else
imgList=$@
echo "Flashing $imgList"
fi
if [ -z "$imgList" ];
then
echo "No img to Flash"
exit 1
else
adb reboot bootloader; for img in $imgList; do fastboot flash ${img%.img} $img; done && fastboot reboot
fi