Skip to content

Instantly share code, notes, and snippets.

@xoebus
Created March 10, 2013 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xoebus/5130970 to your computer and use it in GitHub Desktop.
Save xoebus/5130970 to your computer and use it in GitHub Desktop.
Download and install the latest version of Chromium for Mac.
#!/bin/sh
# Install the latest Chromium mac nightly build, but only
# if it's different from the currently installed version.
set -e
build_url="http://commondatastorage.googleapis.com/chromium-browser-snapshots/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>SCMRevision</key>" |
tail -n 1 |
sed 's/.*<string>\(.*\)<\/string>.*/\1/'
)
# most recent version build available from google
latest=$(curl -s "$build_url/LAST_CHANGE")
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