Skip to content

Commit

Permalink
Simplify fastboot_boot_recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
tsterbak committed Apr 11, 2023
1 parent fa5d04d commit 30761b6
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,30 +382,19 @@ def fastboot_boot_recovery(
bin_path: Path, recovery: str, is_ab: bool = True
) -> TerminalResponse:
"""Temporarily, boot custom recovery with fastboot."""
# TODO: this can be unified now
if is_ab:
logger.info("Boot custom recovery with fastboot.")
for line in run_command(
"fastboot boot", target=f"{recovery}", bin_path=bin_path
):
yield line
logger.info("Boot into TWRP with fastboot.")
for line in adb_wait_for_recovery(bin_path=bin_path):
yield line
else:
logger.info("Boot custom recovery with fastboot.")
for line in run_command(
"fastboot boot", target=f"{recovery}", bin_path=bin_path
):
yield line
logger.info("Boot custom recovery with fastboot.")
for line in run_command(
"fastboot boot", target=f"{recovery}", bin_path=bin_path
):
yield line
if not is_ab:
if (type(line) == bool) and not line:
logger.error("Booting recovery failed.")
yield False
else:
yield True
logger.info("Boot into TWRP with fastboot.")
for line in adb_wait_for_recovery(bin_path=bin_path):
yield line
for line in adb_wait_for_recovery(bin_path=bin_path):
yield line


def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse:
Expand Down

0 comments on commit 30761b6

Please sign in to comment.