Skip to content

Instantly share code, notes, and snippets.

@them
Created June 9, 2011 21:16
Show Gist options
  • Save them/1017774 to your computer and use it in GitHub Desktop.
Save them/1017774 to your computer and use it in GitHub Desktop.
Quick and dirty Chromium downloader for OSX till Chromatic is updated
#!/bin/bash
# Quick and dirty Chromium updater till Chromatic is updated.
# Beware there is no safety net, use at your own risk!
# Where is Chromium installed?
INSTALLFOLDER='/Applications/Internet';
RELEASE_TYPE="snapshots"
# Get current installed version
CURRENT=$(xpath $INSTALLFOLDER/Chromium.app/Contents/Info.plist '/plist/dict/key[. = "SCMRevision"]/following-sibling::string[1]/text()' 2> /dev/null);
# If folder is not existing or parsing failed, force download
if [[ $? != 0 ]] ; then
CURRENT=-1;
fi
# Get latest version from Google
LATEST=$(curl -f -s http://commondatastorage.googleapis.com/chromium-browser-$RELEASE_TYPE/Mac/LAST_CHANGE);
if [[ $? != 0 ]] ; then
echo "Sorry, can not fetch latest version information"
exit 1
fi
# Do nothing if latest version is already installed
if [ "$CURRENT" -ge "$LATEST" ] ; then
echo "Latest version already installed"
exit 0
fi
echo "Current version '$CURRENT'"
echo "Downloading version '$LATEST' ..."
curl -o /tmp/chrome-mac-$LATEST.zip -f -L -# http://commondatastorage.googleapis.com/chromium-browser-$RELEASE_TYPE/Mac/$LATEST/chrome-mac.zip
echo "Extracting download..."
unzip -qq -o /tmp/chrome-mac-$LATEST.zip -d /tmp
rm /tmp/chrome-mac-$LATEST.zip
if [ -d $INSTALLFOLDER/Chromium.app ] ; then
mv $INSTALLFOLDER/Chromium.app ~/.Trash/Chromium.app
fi
mv /tmp/chrome-mac/Chromium.app $INSTALLFOLDER/Chromium.app
rm -R /tmp/chrome-mac
@them
Copy link
Author

them commented Jul 25, 2011

Added version check. Omitting download if unnecessary.

Note to myself: do not add more features in a simple bash script, even more Perl is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment