Created
June 12, 2009 06:02
-
-
Save dekz/128463 to your computer and use it in GitHub Desktop.
Get latest Chromium for OSX from http://chromium.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Chromium Updater | |
# Download and install the newest Chromium build from http://chromium.org | |
# on Mac OS X. | |
import urllib2, os.path, sys | |
BASE_URL = 'http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/' | |
UPDATE_URL = 'http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST' | |
DOWNLOAD_PATH = os.path.expanduser('~/Downloads/Chromium Updater') | |
def latest_build(): | |
return urllib2.urlopen(UPDATE_URL).read() | |
def install(): | |
print 'Extracting files ...' | |
os.system('unzip -q chrome-mac.zip') | |
print 'Removing old files. You might be asked to enter your password.' | |
os.system('sudo rm -rf /Applications/Chromium.app') | |
print 'Installing files. You might be asked to enter your password.' | |
os.system('sudo cp -r chrome-mac/ /Applications/') | |
print 'Removing old files ...' | |
os.system('rm -rf chrome-mac') | |
print 'All done!' | |
def update(): | |
print 'Looking for latest build ...' | |
build = latest_build() | |
print 'Latest build is %s.' % (build) | |
build_download_path = os.path.join(DOWNLOAD_PATH, build) | |
if not os.path.exists(DOWNLOAD_PATH): | |
os.mkdir(DOWNLOAD_PATH) | |
if not os.path.exists(build_download_path) : | |
os.mkdir(build_download_path) | |
if os.path.exists(os.path.join(build_download_path, 'chrome-mac.zip')): | |
print 'You\'re using the newest build. Reinstalling this build ...' | |
os.chdir(build_download_path) | |
install() | |
print 'Reinstalled revision %s' % (build) | |
sys.exit() | |
os.chdir(build_download_path) | |
download_url = BASE_URL + build + '/' + 'chrome-mac.zip' | |
command = 'curl ' + download_url + ' -o chrome-mac.zip' | |
print 'Starting download of file %s' % (download_url) | |
os.system(command) | |
install() | |
print 'Upgraded to revision %s' % (build) | |
if __name__ == '__main__': | |
update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment