diff --git a/install-e.sh b/install-e.sh index 9f0fe3d9f716765b65b2113ce43c287708b1bd50..cf9dbb8f9d80cf0c5db8aff65ef5f83c22a500fc 100755 --- a/install-e.sh +++ b/install-e.sh @@ -57,5 +57,3 @@ sleep 1 adb -s ${DEVICE_ID} shell rm /sdcard/${E_IMAGE} sleep 1 - -adb -s ${DEVICE_ID} reboot diff --git a/wait-reboot.sh b/wait-reboot.sh new file mode 100755 index 0000000000000000000000000000000000000000..3f14c04b135db7a4ac845a1c6cd0af1b4639ca5f --- /dev/null +++ b/wait-reboot.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Parameter +# $1: DEVICE_ID Device we are waiting for reboot + +# Exit status +# - 0 : New device detected +# - 1 : Error +# - 10 : DEVICE_ID is missing +# - 101 : DEVICE_ID is not detected + +DEVICE_ID=$1 + +if [ -z $DEVICE_ID ] +then + exit 10 +fi + +function device_in_recovery +{ + adb devices | grep recovery | grep ${DEVICE_ID} 2>&1 >/dev/null +} + +if ! device_in_recovery +then + exit 101 +fi + +while device_in_recovery +do + sleep 1 +done