summaryrefslogtreecommitdiff
authorPatrik Fimml <patrikf@google.com>2018-11-09 15:06:45 (GMT)
committer Patrik Fimml <patrikf@google.com>2018-11-09 15:24:13 (GMT)
commit886349faddeede6bc1a866e9295a6ee5e8930305 (patch)
tree2af2e101450fe2ac020c30b0d0d2b8008fd69fea
parent64bc3b285adffe51e42a93c3f3055c888c8a6350 (diff)
downloadcommon-886349faddeede6bc1a866e9295a6ee5e8930305.zip
common-886349faddeede6bc1a866e9295a6ee5e8930305.tar.gz
common-886349faddeede6bc1a866e9295a6ee5e8930305.tar.bz2
Make flashall safer to use.
I've bricked Beast a few times because flashing failed, yet the script continued to reboot the device. It's happened to me that I'm in the wrong directory. - Always use image files in the same directory as flash-all.sh. - Abort execution when any command fails (set -e). Test: Flashed Beast from a local build. Change-Id: I6f12afbf3747a29a135961464d9579d66d04472e
Diffstat
-rwxr-xr-xflash-all.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/flash-all.sh b/flash-all.sh
index 822d309..96397a9 100755
--- a/flash-all.sh
+++ b/flash-all.sh
@@ -14,6 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -e
+cd $(dirname $0)
+
lflag="unlock"
if [[ $# -gt 0 ]]; then
lflag="$1"
@@ -31,7 +34,8 @@ fi
if [ "$skipreboot" != "skip" ]
then
- adb $sern reboot fastboot
+ # Ignore failure, in case we are already in fastboot.
+ adb $sern reboot fastboot || true
fi
function flash_with_retry() {
@@ -44,7 +48,6 @@ function flash_with_retry() {
fastboot ${sern} reboot-bootloader
fastboot ${sern} flash ${partition} ${img}
fi
- return 1
}
fastboot $sern flashing unlock_critical