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

Commit fcd3834f authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

update wait-recovery

parent 66da5b17
Loading
Loading
Loading
Loading
+9 −27
Original line number Diff line number Diff line
@@ -18,8 +18,7 @@
# TODO: test if a device go from "sideload" mode to recovery

# Parameter
# $1: DEVICES_LOCKED_PATH temp folder where are stored locked devices
# $2: DEVICE_ID ID of the device to wait
# $1: DEVICE_ID ID of the device to wait

# Return
# - displayed: DEVICE_ID device detected
@@ -29,53 +28,36 @@
# - 1 : Error
# - 101 : DEVICES_LOCKED_PATH missing

DEVICES_LOCKED_PATH=$1
DEVICE_ID=$2

if [ -z $DEVICES_LOCKED_PATH ]
then
  exit 101
fi
DEVICE_ID=$1

if [ ! -z $DEVICE_ID ]
then
  while true
  do
    adb devices | grep --perl-regex "${DEVICE_ID}\trecovery"
  adb -s %DEVICE_ID% wait-for-recovery
    if [ $? == 0 ]
    then
      adb -s ${DEVICE_ID} shell twrp mount system

      exit 0
    fi
  done
fi

function newDevice
{
  for device in $(adb devices | grep recovery | sed 's/\(.*\)\s*recovery/\1/')
  do
    if [ ! -f ${DEVICES_LOCKED_PATH}/${device} ]
    then
      echo ${device}
fi
  done
}

new_device=false

while ! $new_device
do
  DEVICE_ID=$(newDevice)
  DEVICE_ID=$(adb get-serialno)

  if [ ! -z $DEVICE_ID ]
  then
    new_device=true
  fi

  sleep 1
done

adb -s %DEVICE_ID% wait-for-recovery
if [ $? == 0 ]
  then
    adb -s ${DEVICE_ID} shell twrp mount system
  fi

echo ${DEVICE_ID}
+0 −1
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ if not errorlevel 1 (
for /F "tokens=*" %%a IN ('"adb get-serialno "') do (
SET "DEVICE_ID=%%a"
)

if not defined %DEVICE_ID (
  timeout 1 >nul
  goto :while-loop