Grayson (owner)

Revisions

gist: 15426 Download_button fork
public
Description:
A WebKit.app updater script.
Public Clone URL: git://gist.github.com/15426.git
updateWebkit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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