Skip to content

Instantly share code, notes, and snippets.



Last active Mar 28, 2018
What would you like to do?
Automatic iOS firmware downloader
# Author: Luca Zorzi (@LucaTNT)
# Version: 0.2 (2014/11/20)
# License: BSD
# -----------------------------
# This scripts uses's API to check if there are new iOS releases for
# the iOS devices specified in the MODELS array. You can put any number of devices,
# as long as they are in an array (space separated, enclosed in brackets).
# If a new release is available, it gets download into the DESTINATION_FOLDER, respecting
# SPEED_LIMIT for each download: so if say you set SPEED_LIMIT to 1M and you want to download
# firwares for 5 devices, you will end up using (up to) 5 megabyte/s of bandwidth.
# The download will be handled in background by wget. You will be told wget's PID and log file.
# I suggest that you put this script in your crontab to execute it automatically at night.
# If no new versions of iOS are found and older versions of iOS are still present in the
# destination folder, they will be deleted.
MODELS=(iPhone5,2 iPhone5,4 iPhone7,2 iPad4,2 iPad5,4)
pushd $DESTINATION_FOLDER > /dev/null
function downloadFirmware
wget -b --limit=$SPEED_LIMIT $1
for model in ${MODELS[@]}
URL="`wget -q -O -$model/latest/url`"
if [ ! -f $FILENAME ]
echo "New iOS release available for device $model"
echo "Starting download from $URL"
downloadFirmware $URL
echo "No new iOS release for device $model"
if [ `ls $model* | wc -l` -gt 1 ]
echo "Found older firmware version(s) for $model, I'm deleting them."
OLD_VERSION="`ls $model* | grep -v $FILENAME`"
echo "----------------------------------------------------------------"
# Delete old wget-log files
find . -name wget-log\* -mtime +1 -exec rm {} \;
popd > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.