Skip to content

Instantly share code, notes, and snippets.

@stephankaag
Forked from atdt/update-chromium.sh
Created February 26, 2013 17:24
Show Gist options
  • Save stephankaag/5040335 to your computer and use it in GitHub Desktop.
Save stephankaag/5040335 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Update Chromium (on OS X) to the latest nightly build.
install_dir='/Applications/Chromium.app'
base_url='http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac'
build=$(curl -s -f ${base_url}/LAST_CHANGE)
installed=$(/usr/libexec/PlistBuddy -c 'Print :SCMRevision' ${install_dir}/Contents/Info.plist)
script=$(basename $0)
notice () {
echo $(tput setaf 7)[$(tput setaf 4)${script}$(tput setaf 7)]$(tput sgr0) $@
}
do_upgrade () {
curl -# -A "Mozilla/5.0" -L -e ";auto" "${base_url}/${build}/chrome-mac.zip" -o chrome-${build}.zip
mkdir -p ~/tmp &>/dev/null
unzip -q -x chrome-${build}.zip -d ~/tmp &>/dev/null
kill $(ps aux | grep '[C]hromium' | awk '{print $2}')
sleep 2
rm -rf ${install_dir} &>/dev/null
mv ~/tmp/chrome-mac/Chromium.app /Applications
rm chrome-${build}.zip
}
if [[ "${installed}" -ge "${build}" ]]; then
notice "You're running the latest build (${installed})."
exit 1
else
notice "Upgrading to ${build} (you have ${installed})..."
do_upgrade
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment