Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Created August 17, 2011 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhodgins/1152664 to your computer and use it in GitHub Desktop.
Save tomhodgins/1152664 to your computer and use it in GitHub Desktop.
Update Firefox to latest nightly build for OS X
#! /bin/sh
echo "Welcome to FireFetch, the Firefox updater"
echo "This process may take a few minutes"
mkdir ~/.firefetch
cd ~/.firefetch
# This sets a variable named 'LATEST' that is the
# value of the latest Firefox download for OS X
LATEST=`curl -s "http://nightly.mozilla.org" | sed -n 's/.*http/http/'p | sed -n 's/dmg.*/dmg/'p | sed -n 1p`
echo "Downloading Firefox Nightly..."
curl -O $LATEST
echo "Firefox Nightly successfully downloaded!"
# This mounts the DMG, copies the file, and unmounts the DMG
hdid *.dmg
echo "Disk Image Mounted"
rm -R /Applications/Nightly.app
echo "Old Firefox Nightly removed, copying file..."
cp -R /Volumes/Nightly/Nightly.app /Applications/
umount /Volumes/Nightly
rm *.dmg
# This cleans up the temporary directory used to download the files
cd ../
rm -R ~/.FireFetch
echo "All files cleaned up"
while true
do
echo "Would you like to run Firefox now, y or n?"
read CONFIRM
case $CONFIRM in
y|Y|yes|YES|Yes) break ;;
n|N|no|NO|No)
echo "Thanks for using FireFetch, enjoy your fresh Firefox"
exit
;;
*) echo "Please enter yes or no"
esac
done
echo "Launching today's freshest Firefox build"
open -a Nightly.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment