Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e03b8039 authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

Merge branch 'wait-reboot' into 'master'

Wait reboot

See merge request !4
parents e68bfcf8 314e0434
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -57,5 +57,3 @@ sleep 1
adb -s ${DEVICE_ID} shell rm /sdcard/${E_IMAGE}

sleep 1

adb -s ${DEVICE_ID} reboot

wait-reboot.sh

0 → 100755
+47 −0
Original line number Diff line number Diff line
#!/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 <https://www.gnu.org/licenses/>.

# 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