Created
October 8, 2008 01:34
-
-
Save Grayson/15426 to your computer and use it in GitHub Desktop.
A WebKit.app updater script.
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 | |
# Echo some information to STDOUT as well as show a growl notification if available | |
function notify { | |
if [[ -f /usr/local/bin/growlnotify ]]; then | |
echo $1 | /usr/local/bin/growlnotify "Updating WebKit" | |
fi | |
echo $1 | |
} | |
# Compare revisions, bailing if we already have the latest version | |
REVISION=`curl -s http://nightly.webkit.org/ | grep ".dmg" | grep -E -o "r[0-9]+" | head -1` | |
OLDREVISION=`cat /Applications/WebKit.app/Contents/Resources/VERSION` | |
if [[ $REVISION == "r$OLDREVISION" ]]; then | |
notify "Same revision" | |
exit | |
fi | |
# Mount the disk image remotely, saving on cleanup later. | |
notify "Mounting remote disk image for WebKit revision $REVISION..." | |
hdiutil mount "http://builds.nightly.webkit.org/files/trunk/mac/WebKit-SVN-$REVISION.dmg" -quiet | |
# Delete the old version | |
if [[ -d /Applications/WebKit.app ]]; then | |
rm -r /Applications/WebKit.app | |
fi | |
# Copy the new WebKit into Applications | |
notify "Copying WebKit.app to /Applications/" | |
cp -R /Volumes/WebKit/WebKit.app /Applications/ | |
# touch WebKit.app in order to update it's icon (sometimes it appears as a blank app until launched) | |
touch /Applications/WebKit.app | |
# Unmount the remote disk image | |
notify "Unmounting disk image" | |
hdiutil unmount /Volumes/WebKit -quiet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment