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
@iMacThere4iAm
Copy link

I prefer it this way - keeps the temporary files in /tmp and puts the old version in the trash.

#!/bin/bash
# Quick and dirty Chromium updater till Chromatic is updated.
# Beware there is no safety net, use at your own risk!

LATEST=$(curl -f -s http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/LAST_CHANGE);

if [[ $? != 0 ]] ; then
  echo "Sorry, can not fetch latest version information"
  exit 1
fi

echo "Downloading version '$LATEST'..."

curl -o /tmp/chrome-mac-$LATEST.zip -f -L -# http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/$LATEST/chrome-mac.zip

echo "Extracting download..."

unzip -qq -o /tmp/chrome-mac-$LATEST.zip -d /tmp
rm /tmp/chrome-mac-$LATEST.zip
mv /Applications/Chromium.app ~/.Trash/Chromium.app
mv /tmp/chrome-mac/Chromium.app /Applications/Chromium.app
rm -R /tmp/chrome-mac

#echo "All set, have fun!"

@them
Copy link
Author

them commented Jun 20, 2011

Thanks, your changes are integrated.

@ericiles
Copy link

Just thought you'd like to have this. I hex edited chromatic to use the new URL's for nightlies and all is working fine now. You can download it at http://dl.--dropbox.com--/u/970025/Chromatic.zip

NOTE from TheM: remove the dashes from the domain if you really want to download it. I've not tested it and I'll wait for the official release. So use it at your own risk.

@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