Created
November 7, 2009 04:48
-
-
Save rtomayko/228538 to your computer and use it in GitHub Desktop.
Fetch and install the latest Chromium mac nightly.
This file contains hidden or 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
#!/bin/sh | |
# Fetch and install the latest Chromium mac nightly build, but only | |
# if it's different from the currently installed version. An existing | |
# Chromium.app is backed up to .Chromium.app in the same directory. | |
# | |
# Install with: | |
# $ curl -L http://bit.ly/night-chrome > ~/bin/nightly-chromium | |
# $ chmod +x ~/bin/nightly-chromium | |
# | |
# To upgrade to latest chromium version: | |
# $ nightly-chromium | |
# | |
# With cron, use this to get email only when an upgrade happens: | |
# nightly-chromium 2> /dev/null | |
# | |
set -e | |
build_url="http://build.chromium.org/buildbot/snapshots/chromium-rel-mac" | |
install_dir="/Applications/Chromium.app" | |
# determine the currently installed chromium build number | |
current=0 | |
test -d "$install_dir" && current=$( | |
cat "$install_dir/Contents/Info.plist" | | |
grep -A1 "<key>SVNRevision</key>" | | |
tail -n 1 | | |
sed 's/.*<string>\(.*\)<\/string>.*/\1/' | |
) | |
# most recent version build available from google | |
latest=$(curl -s "$build_url/LATEST") | |
if [ "$current" != "$latest" ]; then | |
echo "==> Fetching Chromium build $latest" 1>&2 | |
# setup a temp dir to do some work | |
tmpdir="/tmp/$(basename $0)-$latest" | |
trap "cd / && rm -rf $tmpdir" EXIT | |
mkdir -p "$tmpdir" | |
cd "$tmpdir" | |
# fetch it | |
curl -O "$build_url/$latest/chrome-mac.zip" | |
printf "\n==> Extracting ...\n" 1>&2 | |
unzip -q chrome-mac.zip | |
# remove the previous backup | |
backup_dir="$(dirname $install_dir)/.$(basename $install_dir)" | |
rm -rf "$backup_dir" | |
# backup the currently installed Chromium.app | |
test -d "$install_dir" && | |
mv "$install_dir" "$backup_dir" | |
# move the new one into place | |
mv "chrome-mac/Chromium.app" "$install_dir" | |
echo "==> Chromium upgraded to build $latest (from $current)." | |
else | |
echo "==> You already have build $latest." 1>&2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment