-
-
Save stephankaag/5040335 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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