Skip to content

Commit

Permalink
v9.11
Browse files Browse the repository at this point in the history
  • Loading branch information
DevShaft committed Jun 15, 2014
1 parent eafe10a commit 538b38c
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 77 deletions.
18 changes: 9 additions & 9 deletions Backup-TA.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off
setlocal EnableDelayedExpansion
set VERSION=9.10
set VERSION=9.11

REM #####################
REM ## CHOICE CHECK
Expand All @@ -15,20 +15,20 @@ if "!errorlevel!" == "1" (
set CHOICE=choice
set CHOICE_TEXT_PARAM=
) else (
tools\choice64.exe /T 0 /D Y /C Y /M test > nul 2>&1
tools\choice32.exe /TY,1 /CY > nul 2>&1
if "!errorlevel!" == "1" (
set CHOICE=tools\choice64.exe
set CHOICE_TEXT_PARAM=/M
set CHOICE=tools\choice32.exe
) else (
tools\choice32.exe /TY,1 /CY > nul 2>&1
tools\choice32_alt.exe /T 0 /D Y /C Y /M test > nul 2>&1
if "!errorlevel!" == "1" (
set CHOICE=tools\choice32.exe
set CHOICE=tools\choice32_alt.exe
set CHOICE_TEXT_PARAM=/M
) else (
tools\choice32_alt.exe /T 0 /D Y /C Y /M test > nul 2>&1
tools\choice64.exe /T 0 /D Y /C Y /M test > nul 2>&1
if "!errorlevel!" == "1" (
set CHOICE=tools\choice32_alt.exe
set CHOICE=tools\choice64.exe
set CHOICE_TEXT_PARAM=/M
)
)
)
)
)
Expand Down
14 changes: 14 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Backup TA v9.11 (2014-06-15)
==============================
New Features, Improvements
--------------------------
- Renamed 'Convert v4' to 'Convert TA.img'
- Renamed 'Checking for root...' to 'Checking for SU binary'
- When backup was made from an unknown device block, the tool will first check for the existence of '/dev/block/platform/msm_sdcc.1/by-name/TA' as the destination for the restore before using '/dev/block/mmcblk0p1' as the destination. 3

Fixed Bugs
--------------------------
- Execute all Windows executables with extension to prevent command not found issues on some systems.
- SU binary check failure does not prevent the request for root permissions anymore, in case the SU binary is at an unknown location but indeed callable.
- Changed the order in which the different CHOICE programs are tried in order to hopefully workaround issues on some systems.

Backup TA v9.10 (2013-12-28)
==============================
New Features, Improvements
Expand Down
2 changes: 1 addition & 1 deletion scripts/adb.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ goto:eof

:wakeDevice
set /p "=Waiting for USB Debugging..." < nul
tools\adb wait-for-device > nul
tools\adb.exe wait-for-device > nul
echo OK
goto:eof
36 changes: 18 additions & 18 deletions scripts/backup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,47 @@ REM #####################
if "!backup_taPartitionName!" == "-1" goto:eof
echo --- %1 ---
set /p "=Searching for Operator Identifier..." < nul
tools\adb shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c 'OP_ID='">tmpbak\backup_matchOP_ID
tools\adb.exe shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c 'OP_ID='">tmpbak\backup_matchOP_ID
set /p backup_matchOP_ID=<tmpbak\backup_matchOP_ID
if "!backup_matchOP_ID!" == "1" (
echo +
) else (
echo -
)
set /p "=Searching for Operator Name..." < nul
tools\adb shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c 'OP_NAME='">tmpbak\backup_matchOP_Name
tools\adb.exe shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c 'OP_NAME='">tmpbak\backup_matchOP_Name
set /p backup_matchOP_Name=<tmpbak\backup_matchOP_Name
if "!backup_matchOP_Name!" == "1" (
echo +
) else (
echo -
)
set /p "=Searching for Rooting Status..." < nul
tools\adb shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c 'ROOTING_ALLOWED='">tmpbak\backup_matchRootingStatus
tools\adb.exe shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c 'ROOTING_ALLOWED='">tmpbak\backup_matchRootingStatus
set /p backup_matchRootingStatus=<tmpbak\backup_matchRootingStatus
if "!backup_matchRootingStatus!" == "1" (
echo +
) else (
echo -
)
set /p "=Searching for S1 Boot..." < nul
tools\adb shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c -i 'S1_Boot'">tmpbak\backup_matchS1_Boot
tools\adb.exe shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c -i 'S1_Boot'">tmpbak\backup_matchS1_Boot
set /p backup_matchS1_Boot=<tmpbak\backup_matchS1_Boot
if "!backup_matchS1_Boot!" == "1" (
echo +
) else (
echo -
)
set /p "=Searching for S1 Loader..." < nul
tools\adb shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c -i 'S1_Loader'">tmpbak\backup_matchS1_Loader
tools\adb.exe shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c -i 'S1_Loader'">tmpbak\backup_matchS1_Loader
set /p backup_matchS1_Loader=<tmpbak\backup_matchS1_Loader
if "!backup_matchS1_Loader!" == "1" (
echo +
) else (
echo -
)
set /p "=Searching for S1 Hardware Configuration..." < nul
tools\adb shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c -i 'S1_HWConf'">tmpbak\backup_matchS1_HWConf
tools\adb.exe shell su -c "%BB% cat /dev/block/%1 | %BB% grep -s -m 1 -c -i 'S1_HWConf'">tmpbak\backup_matchS1_HWConf
set /p backup_matchS1_HWConf=<tmpbak\backup_matchS1_HWConf
if "!backup_matchS1_HWConf!" == "1" (
echo +
Expand Down Expand Up @@ -85,9 +85,9 @@ echo.
echo =======================================
echo FIND TA PARTITION
echo =======================================
tools\adb shell su -c "%BB% ls -l %PARTITION_BY_NAME% | %BB% awk '{print \$11}'">tmpbak\backup_defaultTA
tools\adb.exe shell su -c "%BB% ls -l %PARTITION_BY_NAME% | %BB% awk '{print \$11}'">tmpbak\backup_defaultTA
set /p backup_defaultTA=<tmpbak\backup_defaultTA
tools\adb shell su -c "if [ -b '!backup_defaultTA!' ]; then echo '1'; else echo '0'; fi">tmpbak\backup_defaultTAvalid
tools\adb.exe shell su -c "if [ -b '!backup_defaultTA!' ]; then echo '1'; else echo '0'; fi">tmpbak\backup_defaultTAvalid
set /p backup_defaultTAvalid=<tmpbak\backup_defaultTAvalid
if "!backup_defaultTAvalid!" == "1" (
set partition=!backup_defaultTA!
Expand All @@ -103,7 +103,7 @@ if "!backup_defaultTAvalid!" == "1" (
echo INSPECTING PARTITIONS
echo =======================================
set backup_taPartitionName=
tools\adb shell su -c "%BB% cat /proc/partitions | %BB% awk '{if (\$3<=9999 && match (\$4, \"'\"mmcblk\"'\")) print \$4}'">tmpbak\backup_potentialPartitions
tools\adb.exe shell su -c "%BB% cat /proc/partitions | %BB% awk '{if (\$3<=9999 && match (\$4, \"'\"mmcblk\"'\")) print \$4}'">tmpbak\backup_potentialPartitions
for /F "tokens=*" %%A in (tmpbak\backup_potentialPartitions) do call:inspectPartition %%A

if NOT "!backup_taPartitionName!" == "" (
Expand All @@ -127,14 +127,14 @@ echo.
echo =======================================
echo BACKUP TA PARTITION
echo =======================================
tools\adb shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\backup_currentPartitionMD5
tools\adb shell su -c "%BB% dd if=!partition! of=/sdcard/backupTA.img"
tools\adb.exe shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\backup_currentPartitionMD5
tools\adb.exe shell su -c "%BB% dd if=!partition! of=/sdcard/backupTA.img"

echo.
echo =======================================
echo INTEGRITY CHECK
echo =======================================
tools\adb shell su -c "%BB% md5sum /sdcard/backupTA.img | %BB% awk {'print \$1'}">tmpbak\backup_backupMD5
tools\adb.exe shell su -c "%BB% md5sum /sdcard/backupTA.img | %BB% awk {'print \$1'}">tmpbak\backup_backupMD5
set /p backup_currentPartitionMD5=<tmpbak\backup_currentPartitionMD5
set /p backup_backupMD5=<tmpbak\backup_backupMD5
verify > nul
Expand All @@ -149,14 +149,14 @@ echo.
echo =======================================
echo PULL BACKUP FROM SDCARD
echo =======================================
tools\adb pull /sdcard/backupTA.img tmpbak\TA.img
tools\adb.exe pull /sdcard/backupTA.img tmpbak\TA.img
if NOT "!errorlevel!" == "0" goto onBackupFailed

echo.
echo =======================================
echo INTEGRITY CHECK
echo =======================================
tools\md5 -l -n tmpbak\TA.img>tmpbak\backup_backupPulledMD5
tools\md5.exe -l -n tmpbak\TA.img>tmpbak\backup_backupPulledMD5
if NOT "!errorlevel!" == "0" goto onBackupFailed
set /p backup_backupPulledMD5=<tmpbak\backup_backupPulledMD5
verify > nul
Expand All @@ -171,14 +171,14 @@ echo.
echo =======================================
echo PACKAGE BACKUP
echo =======================================
tools\adb get-serialno>tmpbak\TA.serial
tools\adb.exe get-serialno>tmpbak\TA.serial
echo !partition!>tmpbak\TA.blk
echo !backup_backupPulledMD5!>tmpbak\TA.md5
echo %VERSION%>tmpbak\TA.version
tools\adb shell su -c "%BB% date +%%Y%%m%%d.%%H%%M%%S">tmpbak\TA.timestamp
tools\adb.exe shell su -c "%BB% date +%%Y%%m%%d.%%H%%M%%S">tmpbak\TA.timestamp
set /p backup_timestamp=<tmpbak\TA.timestamp
cd tmpbak
..\tools\zip a ..\backup\TA-backup-!backup_timestamp!.zip TA.img TA.md5 TA.blk TA.serial TA.timestamp TA.version
..\tools\zip.exe a ..\backup\TA-backup-!backup_timestamp!.zip TA.img TA.md5 TA.blk TA.serial TA.timestamp TA.version
if NOT "!errorlevel!" == "0" goto onBackupFailed
cd..

Expand Down Expand Up @@ -233,5 +233,5 @@ set partition=

if "%~1" == "1" del /q /s tmpbak\backup_*.* > nul 2>&1
if "%~1" == "1" del /q /s tmpbak\TA.* > nul 2>&1
tools\adb shell rm /sdcard/backupTA.img > nul 2>&1
tools\adb.exe shell rm /sdcard/backupTA.img > nul 2>&1
goto:eof
6 changes: 3 additions & 3 deletions scripts/busybox.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ REM ## PUSH BUSYBOX
REM #####################
:pushBusyBox
set /p "=Pushing Backup TA Tools..." < nul
tools\adb push tools\busybox /data/local/tmp/busybox-backup-ta > nul 2>&1
tools\adb shell chmod 755 /data/local/tmp/busybox-backup-ta > nul 2>&1
tools\adb.exe push tools\busybox /data/local/tmp/busybox-backup-ta > nul 2>&1
tools\adb.exe shell chmod 755 /data/local/tmp/busybox-backup-ta > nul 2>&1
set BB=/data/local/tmp/busybox-backup-ta
echo OK
goto:eof
Expand All @@ -17,7 +17,7 @@ REM ## REMOVE BUSYBOX
REM #####################
:removeBusyBox
set /p "=Removing Backup TA Tools..." < nul
tools\adb shell rm /data/local/tmp/busybox-backup-ta > nul 2>&1
tools\adb.exe shell rm /data/local/tmp/busybox-backup-ta > nul 2>&1
set bb=
echo OK
goto:eof
Expand Down
23 changes: 4 additions & 19 deletions scripts/convert.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,7 @@ goto:eof
REM #####################
REM ## CONVERT
REM #####################
:showConvertV4
echo.
echo =======================================
echo INSTRUCTIONS CONVERTING v4 BACKUP
echo =======================================
echo 1. Make sure the image (backup file) is named TA.img
echo 2. Make a new file called TA.md5 and in this file save the MD5 hash of TA.img.
echo 3. ZIP both TA.img and TA.md5 in a ZIP file called TA-backup.zip
echo 4. Save this ZIP file in the 'Backup-TA\backup' folder.
echo.
pause
call:exit
goto:eof

:convertV4
:convertRawTA
echo.
echo =======================================
echo PROVIDE BACKUP
Expand All @@ -34,15 +20,15 @@ if NOT exist convert-this\TA.img (
echo There is no 'TA.img' file found inside the 'convert-this' folder.
goto copyTAFile
)
tools\md5 -l -n convert-this\TA.img>convert-this\TA.md5
tools\md5.exe -l -n convert-this\TA.img>convert-this\TA.md5
echo.
echo =======================================
echo PACKAGE BACKUP
echo =======================================
tools\adb shell su -c "%BB% date +%%Y%%m%%d.%%H%%M%%S">tmpbak\convert_timestamp
tools\adb.exe shell su -c "%BB% date +%%Y%%m%%d.%%H%%M%%S">tmpbak\convert_timestamp
set /p convert_timestamp=<tmpbak\convert_timestamp
cd convert-this
..\tools\zip a ..\backup\TA-backup-!convert_timestamp!.zip TA.img TA.md5
..\tools\zip.exe a ..\backup\TA-backup-!convert_timestamp!.zip TA.img TA.md5
if NOT "!errorlevel!" == "0" goto onConvertFailed
cd..
call:exit 1
Expand Down Expand Up @@ -91,7 +77,6 @@ if "%~1" == "1" (

if exist convert-this (
del /q /s convert-this\*.*
rmdir convert-this
)
)
goto:eof
8 changes: 4 additions & 4 deletions scripts/menu.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ echo [ !menu_currentIndex!. Restore dry-run
set /a menu_currentIndex+=1 >nul
set menu_choices=!menu_choices!!menu_currentIndex!

echo [ !menu_currentIndex!. Convert v4 backup ]
echo [ !menu_currentIndex!. Convert TA.img ]

set /a menu_currentIndex+=1 >nul
set menu_choices=!menu_choices!!menu_currentIndex!
Expand Down Expand Up @@ -94,15 +94,15 @@ if "!menu_decision!" == "3" (
if "!menu_decision!" == "4" (
echo.
echo =======================================
echo CONVERT V4 BACKUP
echo CONVERT TA.IMG
echo =======================================
echo When you continue Backup TA will ask you to copy your v4 backup to a location
echo When you continue Backup TA will ask you to copy your TA.img file to a location
echo and then convert this backup to make it compatible with the latest version
echo of Backup TA.
echo.
%CHOICE% /c:yn %CHOICE_TEXT_PARAM% "Are you sure you want to continue?"
if "!errorlevel!" == "2" goto showMenu
call scripts\convert.bat convertV4
call scripts\convert.bat convertRawTA
set menu_decision=0
)
if "!menu_decision!" == "5" (
Expand Down
Loading

0 comments on commit 538b38c

Please sign in to comment.