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

Commit 247578ba authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

update wait-reboot.sh

parent 6532c3ac
Loading
Loading
Loading
Loading
+8 −14
Original line number Diff line number Diff line
@@ -21,39 +21,33 @@
# $2: ADB_FOLDER_PATH: the path where runnable adb is stored

# Exit status
# - 0 : New device detected
# - 0 : success
# - 1 : Error
# - 10 : DEVICE_ID is missing
# - 101 : DEVICE_ID is not detected
# - 101 : device with DEVICE_ID is not detected

DEVICE_ID=$1
ADB_FOLDER_PATH=$2
ADB_PATH=""


if [ ! -z $ADB_FOLDER_PATH ]
then
ADB_PATH=${ADB_FOLDER_PATH}"adb"
else
  ADB_PATH=adb
fi

echo "ADB path: $ADB_PATH"

if [ -z $DEVICE_ID ]
if [ -z "$DEVICE_ID" ]
then
  exit 10
fi


#1 On check that device is in recovery mode
$ADB_PATH -s ${DEVICE_ID} get-state 2>&1 | grep "recovery"
if [ $? != 0 ]
if ! "$ADB_PATH" -s "$DEVICE_ID" get-state 2>&1 | grep "recovery"
then
	echo "Device not detected in recovery"
	exit 101
fi

#Then we wait that it left this state
while $ADB_PATH -s ${DEVICE_ID} get-state 2> /dev/null
while "$ADB_PATH" -s "$DEVICE_ID" get-state 2> /dev/null
do
	sleep 1
done
 No newline at end of file