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

Commit 92718f76 authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

update wait-recovery.bat. checked and validated

parent 62cfaebf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -23,8 +23,8 @@


:heimdall_detect
heimdall detect >nul 2>&1
if %errorLevel==1 (
heimdall detect >nul
if errorLevel 1 (
	timeout 1 >nul
	goto :heimdall_detect
) 
+19 −31
Original line number Diff line number Diff line
@@ -18,7 +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 (optionnal)

:: Return
:: - displayed: DEVICE_ID device detected
@@ -28,43 +28,31 @@
:: - 1 : Error
:: - 101 : DEVICES_LOCKED_PATH missing

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

:no_device_id
    adb devices | findstr "%DEVICE_ID%\trecovery"
    if not errorLevel 1 (
:: check device_ID est définit
if defined %DEVICE_ID (
adb -s %DEVICE_ID% wait-for-recovery
if not errorlevel 1 (
  adb -s %DEVICE_ID% shell twrp mount system
  exit /b 0
)
    else (GOTO :no_device_id)


if not defined %DEVICE_ID (
  call :no_device_id
)

:newDevice
{
  ::replace for loop
  for device in $(adb devices | findstr recovery | sed 's/\(.*\)\s*recovery/\1/')
  do
      echo %device%
  done
}

set "new_device=false"

::While no devide_id defined: try to find one
:while-loop
for /F "tokens=*" %%a IN ('"adb get-serialno "') do (
SET "DEVICE_ID=%%a"
)

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

call :not_new_device

adb -s %DEVICE_ID% shell twrp mount system
adb -s %DEVICE_ID% wait-for-recovery
if not errorLevel 1 ( adb -s %DEVICE_ID% shell twrp mount system )

echo %DEVICE_ID%