WebKit Nightly Update Script

This is a repost of a much older post that was lost when I transitioned from Moveable Type 3 to 4.

I personally like using WebKit nightlies as my main browser as it’s more or less Safari with a better, faster, and much more current rendering engine underneath it. That and the gold logo looks much better than the silver. It does have bugs occasionally (for example I was unable to post comments to Flickr with WebKit nightlies for a couple weeks) but all in all the experience is very positive. This is the script I use to keep WebKit updated whenever it bugs me for an update. I use an alias in my .bashrc file so I can just type ‘wkupdate’ to run the shell script. The best part is that if I copy it and I’m still using the program the changes won’t take effect until I restart but it allows me to copy it still. (Not advisable however)

#! /bin/bash

#Find current revision
currentRevision=`cat /Applications/WebKit.app/Contents/Resources/VERSION`

#Get address
#Download start page and find address
address=`curl -s http://nightly.webkit.org/start/trunk/$currentRevision | grep 'WebKit-SVN-r[0-9]*' -o | head -n 1`

#Abort if there is no update
if [ "$address" == "" ]
then
    echo "There is no update for WebKit available"
    exit
fi

#Append download address
address='http://nightly.webkit.org/files/trunk/mac/'${address}'.dmg'

echo "Downloading... $address"
curl -s $address -o /tmp/WebKit.dmg
#Mount Image
hdid -readonly -quiet /tmp/WebKit.dmg

echo "Copying..."
#Copy to Applications
revision=`cat /Volumes/WebKit/WebKit.app/Contents/Resources/VERSION`

cp -RfL /Volumes/WebKit/* /Applications/ 2>/dev/null
ls /Volumes/WebKit/

echo "Cleaning up..."
#Clean up
hdiutil detach /Volumes/WebKit/ -quiet
rm -rf /tmp/WebKit.dmg

echo "Finished. (r$revision)"

EDIT: Updated 12/30/08 - Fixed URL check. Realistically you should be looking for the latest source at the link below:

As always this script can be found in my git repository on GitHub.