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

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

update wait-recovery.bat

parent d9448754
Loading
Loading
Loading
Loading
+4 −13
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: DEVICES_LOCKED_PATH temp folder where are stored locked devices:: $2: DEVICE_ID ID of the device to wait

:: Return
:: - displayed: DEVICE_ID device detected
@@ -29,15 +28,10 @@
:: - 1 : Error
:: - 101 : DEVICES_LOCKED_PATH missing

set "DEVICES_LOCKED_PATH=%1"
set "DEVICE_ID=%2"

if not defined %DEVICES_LOCKED_PATH (
  exit /b 101
)

:no_device_id
    adb devices | findstr --perl-regex "%DEVICE_ID%\trecovery"
    adb devices | findstr "%DEVICE_ID%\trecovery"
    if not errorLevel 1 (
      adb -s %DEVICE_ID% shell twrp mount system
      exit /b 0
@@ -54,9 +48,7 @@ if not defined %DEVICE_ID (
  ::replace for loop
  for device in $(adb devices | findstr recovery | sed 's/\(.*\)\s*recovery/\1/')
  do
    if [ ! -f %DEVICES_LOCKED_PATH%/%device% ] (
      echo %device%
    )
  done
}

@@ -65,10 +57,9 @@ set "new_device=false"

:not_new_device
if not %newDevice (
  ::Call to method :newDevice
  SET DEVICE_ID=$(newDevice)
  if defined %DEVICE_ID (
    set "new_device=true"
  )
  if defined %DEVICE_ID ( set "new_device=true" )
  timeout 1 >nul
)else (GOTO :not_new_device)