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

Commit 3228817d authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

update bashToBatch.md, install-from-recovery.bat and add wait-reboot.bat

parent 0a882dd0
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -29,3 +29,7 @@ This files contains mapping of bash command for batch and sometimes to OSX comma
- `ping -c` => `ping -n`
- `ping -c` => `ping -n`
- `# comment` => ` rem comment` but not efficient at all. Thus use `:: comment`. 
- `# comment` => ` rem comment` but not efficient at all. Thus use `:: comment`. 
- `sleep 1` => `timeout 1 >nul`
- `sleep 1` => `timeout 1 >nul`
- `grep` => `findstr`

## Loop
- `while <condition>` => `:myFunction if <condition> (goto :myFunction)` (it's a recursive  function) 
 No newline at end of file
+8 −8
Original line number Original line Diff line number Diff line
@@ -34,27 +34,27 @@ for %%a in ("%ARCHIVE_PATH%") do (
	set "ARCHIVE_NAME=%%~na"
	set "ARCHIVE_NAME=%%~na"
)
)


if not defined DEVICE_ID (
if not defined %DEVICE_ID (
  exit /b 101
  exit /b 101
)
)


if not defined ARCHIVE_PATH (
if not defined %ARCHIVE_PATH (
  exit /b 102
  exit /b 102
)
)


adb -s ${DEVICE_ID} shell twrp wipe system
adb -s %DEVICE_ID% shell twrp wipe system
adb -s ${DEVICE_ID} shell twrp wipe cache
adb -s %DEVICE_ID% shell twrp wipe cache
adb -s ${DEVICE_ID} shell twrp wipe data
adb -s %DEVICE_ID% shell twrp wipe data
adb -s ${DEVICE_ID} push  ${ARCHIVE_PATH} /sdcard
adb -s %DEVICE_ID% push  %ARCHIVE_PATH% /sdcard


if errorLevel 1 ( exit /b 2 )
if errorLevel 1 ( exit /b 2 )


adb -s ${DEVICE_ID} shell twrp install /sdcard/${ARCHIVE_NAME}
adb -s %DEVICE_ID% shell twrp install /sdcard/%ARCHIVE_NAME%


if errorLevel 1 ( exit /b 3 )
if errorLevel 1 ( exit /b 3 )


timeout 1 >nul
timeout 1 >nul


adb -s ${DEVICE_ID} shell rm /sdcard/${ARCHIVE_NAME}
adb -s %DEVICE_ID% shell rm /sdcard/%ARCHIVE_NAME%


timeout 1 >nul
timeout 1 >nul
+44 −0
Original line number Original line 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

set "DEVICE_ID=%1"

if not defined %DEVICE_ID ( exit /b 10)

:device_in_recovery
{
  adb devices | findstr recovery | grep %DEVICE_ID% 2>&1 >nul
}

if not call :device_in_recovery ( exit /b 101 )


:while_loop
if call :device_in_recovery (
	timeout 1 >nul
	goto :while_loop
)