Skip to content

Instantly share code, notes, and snippets.

@patrickgill
Last active August 29, 2015 14:20
Show Gist options
  • Save patrickgill/2cc98eee49efca4603e0 to your computer and use it in GitHub Desktop.
Save patrickgill/2cc98eee49efca4603e0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Name : firmwhere
# Purpose : Lists and (optionally) downloads all iOS firmware updates
# Based on: https://gist.github.com/jordanmerrick/3447610
# -----------------------------------------------------------------------------
# set up a temporary file
file="$(/usr/bin/mktemp -q -t firmwhere)"
# fetch the XML file from Apple's update server
curl -sS http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version |
# display only URLs
sed -nE 's#^[[:space:]]*<string>(http://.+ipsw)</string>$#\1#p' |
# ignore recovery files
grep -v Recovery |
# sort alphabetically and strip duplicates, then dump to temp file
sort -u > "$file"
# output filename
echo "$file"
# -----------------------------------------------------------------------------
# uncomment to download *all* the files (139 as of 2014-03-25) to $PWD
# -----------------------------------------------------------------------------
# # use cURL
# while read url; do
# curl -O "$file"
# done < "$file"
# # use wget and skip downloaded updates
# wget --mirror --no-directories --input-file="$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment