NOTE: Google has changed the way the Chromium Buildbot and related services work; this post is no longer valid without modification.
Some web-browser lovers like to live dangerously; always staying on the cutting, and bleeding (mostly bleeding) edge. These are users of Chromium, the open source project on which Google Chrome is based.
Chromium is an amazingly portable browser and is updated several times a day with new code patches and bug fixes. However, unlike Chrome, Chromium does not automatically update itself from the latest nightly build (which may be good since this is a development build and may not work at all). So, what do you do when you want to keep up with the latest release of Chromium? You create a batch file to update it for you of course! This little script will check for updates to the Windows, Linux, and Mac versions of Chromium and download them to the working directory. The script uses cURL to download files and the command line version of 7-Zip for extracting them. I have placed these two utilities in the “bin” directory on the flash drive which I keep Chromium on; however, you can change the path to anything you want in the first few lines of code. What you will probably take away from this example is “never do anything with a batch file that you can do better with PowerShell.”
@ECHO OFF SET CURL=bin\curl.exe SET ZIP=bin\7za.exe IF [%1]==[WIN32] ( SET OS=win32 SET CHROMEPATH=http://build.chromium.org/buildbot/continuous/win/LATEST GOTO UPDATE ) IF [%1]==[LINUX] ( SET OS=linux SET CHROMEPATH=http://build.chromium.org/buildbot/continuous/linux/LATEST GOTO UPDATE ) IF [%1]==[MAC] ( SET OS=mac SET CHROMEPATH=http://build.chromium.org/buildbot/continuous/mac/LATEST GOTO UPDATE ) CALL %0 WIN32 CALL %0 LINUX CALL %0 MAC EXIT /B :UPDATE %CURL% -s "%CHROMEPATH%/REVISION" > REVISION_%OS% || EXIT /B IF NOT EXIST REVISION_%OS% ( ECHO Unknown error checking %OS% revision! EXIT /B ) IF NOT EXIST REVISION_CURRENT_%OS% ( COPY REVISION_%OS% REVISION_CURRENT_%OS% SET /P REVISION=<REVISION_%OS% SET REVISION_CURRENT=None GOTO STARTUPDATE ) SET /P REVISION=<REVISION_%OS% SET /P REVISION_CURRENT=<REVISION_CURRENT_%OS% IF %REVISION%==%REVISION_CURRENT% ( ECHO No update available for %OS%! DEL REVISION_%OS% EXIT /B ) :STARTUPDATE ECHO New Update %REVISION% available for %OS% (Current: %REVISION_CURRENT%) ECHO Downloading revision %REVISION% from %CHROMEPATH%/chrome-%OS%.zip... %CURL% %CHROMEPATH%/chrome-%OS%.zip > CHROME_%OS%.zip %ZIP% x CHROME_%OS%.zip -y || EXIT /b DEL CHROME_%OS%.zip DEL REVISION_CURRENT_%OS% REN REVISION_%OS% REVISION_CURRENT_%OS% ECHO Update completed successfully! ECHO Now at revision %REVISION% for %OS% :ENDUPDATE
To use the script save it in the directory where Chromium will be saved and run it with the following syntax:
If no OS argument is given it will update all three versions of the software one at a time. If you want to change the default, remove one or more of the following lines of code:
CALL %0 WIN32 CALL %0 LINUX CALL %0 MAC