diff --git a/Backup-TA.bat b/Backup-TA.bat index c0e9089..223acc0 100644 --- a/Backup-TA.bat +++ b/Backup-TA.bat @@ -1,6 +1,6 @@ @echo off setlocal EnableDelayedExpansion -set VERSION=9.10 +set VERSION=9.11 REM ##################### REM ## CHOICE CHECK @@ -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 - ) + ) ) ) ) diff --git a/changelog.txt b/changelog.txt index bf49e7d..7c3f0bc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/scripts/adb.bat b/scripts/adb.bat index 3cac941..6cd3ead 100644 --- a/scripts/adb.bat +++ b/scripts/adb.bat @@ -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 \ No newline at end of file diff --git a/scripts/backup.bat b/scripts/backup.bat index 51ecb9c..9741eac 100644 --- a/scripts/backup.bat +++ b/scripts/backup.bat @@ -8,7 +8,7 @@ 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_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_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_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_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_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_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!" == "" ( @@ -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= nul @@ -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= nul @@ -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= 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 \ No newline at end of file diff --git a/scripts/busybox.bat b/scripts/busybox.bat index c55ac2b..97a2ecd 100644 --- a/scripts/busybox.bat +++ b/scripts/busybox.bat @@ -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 @@ -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 diff --git a/scripts/convert.bat b/scripts/convert.bat index 3f7248c..c171dfa 100644 --- a/scripts/convert.bat +++ b/scripts/convert.bat @@ -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 @@ -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=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! @@ -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" ( diff --git a/scripts/restore.bat b/scripts/restore.bat index 66cc146..f0f609b 100644 --- a/scripts/restore.bat +++ b/scripts/restore.bat @@ -24,7 +24,7 @@ echo. if "!restore_dryRun!" == "1" ( echo --- Restore dry run --- ) -tools\adb get-serialno>tmpbak\restore_serialno +tools\adb.exe get-serialno>tmpbak\restore_serialno set /p restore_serialno= nul @@ -61,12 +61,20 @@ echo. echo ======================================= echo EXTRACT BACKUP echo ======================================= -tools\zip x -y backup\!restore_restoreFile! -otmpbak +tools\zip.exe x -y backup\!restore_restoreFile! -otmpbak if NOT "!errorlevel!" == "0" goto onRestoreFailed if exist tmpbak\TA.blk ( set /p partition=tmpbak\restore_defaultTA + set /p restore_defaultTA=tmpbak\restore_defaultTAvalid + set /p restore_defaultTAvalid=tmpbak\restore_backupMD5 +tools\md5.exe -l -n tmpbak\TA.img>tmpbak\restore_backupMD5 if NOT "!errorlevel!" == "0" goto onRestoreFailed set /p restore_backupMD5= nul @@ -94,7 +102,7 @@ echo. echo ======================================= echo COMPARE TA PARTITION WITH BACKUP echo ======================================= -tools\adb shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\restore_currentPartitionMD5 +tools\adb.exe shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\restore_currentPartitionMD5 set /p restore_currentPartitionMD5= nul if "!restore_currentPartitionMD5!" == "!restore_savedBackupMD5!" ( @@ -108,9 +116,9 @@ echo. echo ======================================= echo BACKUP CURRENT TA PARTITION echo ======================================= -tools\adb shell su -c "%BB% dd if=!partition! of=/sdcard/revertTA.img && %BB% sync && %BB% sync && %BB% sync && %BB% sync" +tools\adb.exe shell su -c "%BB% dd if=!partition! of=/sdcard/revertTA.img && %BB% sync && %BB% sync && %BB% sync && %BB% sync" if NOT "!errorlevel!" == "0" goto onRestoreFailed -tools\adb shell su -c "%BB% ls -l /sdcard/revertTA.img | %BB% awk {'print \$5'}">tmpbak\restore_revertTASize +tools\adb.exe shell su -c "%BB% ls -l /sdcard/revertTA.img | %BB% awk {'print \$5'}">tmpbak\restore_revertTASize set /p restore_revertTASize= nul @@ -118,15 +126,15 @@ echo. echo ======================================= echo PUSH BACKUP TO SDCARD echo ======================================= -tools\adb push tmpbak\TA.img sdcard/restoreTA.img +tools\adb.exe push tmpbak\TA.img sdcard/restoreTA.img if NOT "!errorlevel!" == "0" goto onRestoreFailed echo. echo ======================================= echo INTEGRITY CHECK echo ======================================= -tools\adb shell su -c "%BB% ls -l /sdcard/restoreTA.img | %BB% awk {'print \$5'}">tmpbak\restore_pushedBackupSize -tools\adb shell su -c "%BB% md5sum /sdcard/restoreTA.img | %BB% awk {'print \$1'}">tmpbak\restore_pushedBackupMD5 +tools\adb.exe shell su -c "%BB% ls -l /sdcard/restoreTA.img | %BB% awk {'print \$5'}">tmpbak\restore_pushedBackupSize +tools\adb.exe shell su -c "%BB% md5sum /sdcard/restoreTA.img | %BB% awk {'print \$1'}">tmpbak\restore_pushedBackupMD5 if NOT "!errorlevel!" == "0" goto onRestoreFailed set /p restore_pushedBackupSize=tmpbak\restore_backupSerial + tools\adb.exe shell su -c "%BB% cat /sdcard/restoreTA.img | %BB% grep -m 1 -o !restore_serialno!">tmpbak\restore_backupSerial if NOT "!errorlevel!" == "0" goto unknownDevice copy tmpbak\restore_backupSerial tmpbak\TA.serial > nul 2>&1 ) @@ -179,18 +187,18 @@ echo ======================================= echo RESTORE BACKUP echo ======================================= if NOT "%restore_dryRun%" == "1" ( - tools\adb shell su -c "%BB% dd if=/sdcard/restoreTA.img of=!partition! && %BB% sync && %BB% sync && %BB% sync && %BB% sync" + tools\adb.exe shell su -c "%BB% dd if=/sdcard/restoreTA.img of=!partition! && %BB% sync && %BB% sync && %BB% sync && %BB% sync" if NOT "!errorlevel!" == "0" goto onRestoreFailed ) else ( echo --- dry run --- ) -tools\adb shell su -c "rm /sdcard/restoreTA.img" +tools\adb.exe shell su -c "rm /sdcard/restoreTA.img" echo. echo ======================================= echo COMPARE NEW TA PARTITION WITH BACKUP echo ======================================= -tools\adb shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\restore_restoredMD5 +tools\adb.exe shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\restore_restoredMD5 if NOT "%restore_dryRun%" == "1" ( set /p restore_restoredMD5= nul @@ -239,14 +247,14 @@ echo ======================================= echo REVERT RESTORE echo ======================================= if NOT "%restore_dryRun%" == "1" ( - tools\adb shell su -c "%BB% dd if=/sdcard/revertTA.img of=%partition% && %BB% sync && %BB% sync && %BB% sync && %BB% sync" + tools\adb.exe shell su -c "%BB% dd if=/sdcard/revertTA.img of=%partition% && %BB% sync && %BB% sync && %BB% sync && %BB% sync" ) echo. echo ======================================= echo REVERT VERIFICATION echo ======================================= -tools\adb shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\restore_revertedMD5 +tools\adb.exe shell su -c "%BB% md5sum !partition! | %BB% awk {'print \$1'}">tmpbak\restore_revertedMD5 if NOT "%restore_dryRun%" == "1" ( set /p restore_revertedMD5= nul 2>&1 if "%~1" == "1" del /q /s tmpbak\TA.* > nul 2>&1 -tools\adb shell rm /sdcard/restoreTA.img > nul 2>&1 -tools\adb shell rm /sdcard/revertTA.img > nul 2>&1 +tools\adb.exe shell rm /sdcard/restoreTA.img > nul 2>&1 +tools\adb.exe shell rm /sdcard/revertTA.img > nul 2>&1 goto:eof \ No newline at end of file diff --git a/scripts/root.bat b/scripts/root.bat index 674409b..d8ba424 100644 --- a/scripts/root.bat +++ b/scripts/root.bat @@ -5,7 +5,7 @@ REM ##################### REM ## ROOT CHECK REM ##################### :check -set /p "=Checking for root..." < nul +set /p "=Checking for SU binary..." < nul tools\adb shell %BB% ls /system/bin/su>tmpbak\su set /p su=tmpbak\rootPermission set /p rootPermission=