Real programmers don’t use butterflies; real programmers use Windows batch files (and real web-browser-ers use Chromium).
NOTE: Google has changed the way the Chromium Buildbot and related services work; this post is no longer valid without modification.
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:
UpdateChromium [WIN32|LINUX|MAC]
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
2 comments:
Can you please help me out? I'm not a super-technical computer person, but use Chromium b/c it supports an important extension that Chrome does not. However, I unfortunately don't understand your instructions above...can you please help a noob out? :-)
Kim:
I'd be happy to help you, but if you're unsure of what you're doing this probably isn't the method for you. This script updates from the most recent build of Chromium which sometimes won't work at all. Also, it requires Windows to run.
If you still want to use it, create a file with the extension ".bat", open it with notepad, and paste the script into it. Then you can just click on the bat file to download and update Chromium.
P.S. If you don't want Linux and Mac versions of Chromium to be downloaded as well you can remove the lines that say
CALL %0 LINUX
CALL %0 MAC
P.P.S. You'll also need 7zip and curl for this to work. Download them and then change the lines that read
SET CURL=bin\curl.exe
SET ZIP=bin\7za.exe
to point to their location on your computer.
This was actually a poor way to call these two utilities on my part; I may change how this works later.
Post a Comment