Skip to content

Instantly share code, notes, and snippets.

@pulser
Created August 8, 2010 10:10
Show Gist options
  • Save pulser/ef9aae03b68cc0ffe8f7 to your computer and use it in GitHub Desktop.
Save pulser/ef9aae03b68cc0ffe8f7 to your computer and use it in GitHub Desktop.
@echo off
echo --------------------------------------
echo -- --
echo -- Update .zip maker v1.0 --
echo -- by DMzda and daentech --
echo -- --
echo --------------------------------------
IF NOT EXIST %1 echo Invalid path
IF NOT EXIST %1 goto setfolder
SET folder=%1
goto metainf
:setfolder
SET /P folder=Please enter path:
IF NOT EXIST %folder% echo Invalid path
IF NOT EXIST %folder% exit
:metainf
echo Making META-INF directory
mkdir %folder%\META-INF\com\google\android
:scriptselect
set /P updatescript=[s]ystem,[d]ata or [b]oth
if /I %updatescript%==s goto system
if /I %updatescript%==d goto data
if /I %updatescript%==b goto both
echo Invalid selection
goto scriptselect
:system
COPY C:\Android\SDK\tools\NOTSDK\Updatezipmaker\update-script-system %folder%\META-INF\com\google\android\update-script
goto zip
:data
COPY C:\Android\SDK\tools\NOTSDK\Updatezipmaker\update-script-data %folder%\META-INF\com\google\android\update-script
goto zip
:both
COPY C:\Android\SDK\tools\NOTSDK\Updatezipmaker\update-script-both %folder%\META-INF\com\google\android\update-script
goto zip
:zip
echo Zipping update
7z a -r %folder%.zip %folder%\*
echo Signing .zip
java -jar testsign.jar %folder%.zip %folder%-signed.zip
echo moving zips
mv %folder%.zip %folder%
mv %folder%-signed.zip %folder%
:phonepluggedin
set /P phone=Is your phone plugged in? [Y/N]
if /I %phone%==y goto phone_yes
if /I %phone%==n goto phone_no
echo Invalid selection
goto phonepluggedin
:phone_yes
echo Do you wish to push the file to the phones SD card?
set /p push = [Y/N]
if /I %push%==N goto phone_no
echo Pushing zip to sdcard
adb push %folder%-signed.zip /sdcard/
echo Do you wish to reboot to recovery now and autoflash?
set /p reboot = [Y/N]
if /I %reboot%==y goto reboot
goto end
:phone_no
echo Update .zip created!
echo %folder%\
goto end
:reboot
echo Preparing to autoflash...
adb shell mkdir -p /cache/recovery/
REM adb shell "echo 'boot-recovery' >/cache/recovery/command"
REM adb shell echo 'boot-recovery' >/cache/recovery/command
echo boot-recovery > recoverycommand
echo --update_package=SDCARD:%folder%-signed.zip >> recoverycommand
echo Rebooting your phone into recovery now
adb reboot recovery
goto end
:end
echo Thanks for using this script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment