Die aktuelle iOS Version zu einem Gerät lädt iTunes immer erst bei Bedarf, wenn man also z.B. im Service immer wieder verschiedene Geräte anschließt, kann es sein, dass man bei fast jedem Gerät erneut auf den Download der passen Software warten darf.
Apple bietet hierfür die Möglichkeit einen OSX Server als Software-Update Cache zu nutzen, nur braucht man dafür nun mal OSX-Server. Damit man die Software-Updates auch so vorab speichern kann, kann man auch dieses Skript nutzen, um sich z.B. alle iPhone Updates vorab zu laden. Das Skript nutzt eine Download-Liste von Apple wie hier beschrieben, um die jeweils neuest Software-Version für wahlweise alle iPods, iPads, iPhones oder AppleTVs zu laden.
Die Updates werden direkt in den passenden Ordner unter ~/Library/iTunes
geladen, sofern es dort nicht bereits schon eine entsprechende Datei gibt.
Seid aber gewarnt, zum aktuellen Zeitpunkt umfasst diese Update-Sammlung gute 65 GB an iOS Updates!
--10.10.2014 hubionmac.com
--Downloads latest ipsw software packages from apple and stores thems in your local itunes folder (~/Library/iTunes)
--So you can pre-load software-updates of ios Devices before you connect them (ios Software update Cache)
-- uses url found @ http://osxdaily.com/2013/11/15/get-list-all-ipsw-files-from-apple/
-- Tested using OSX 10.9.5 (minimum OS since script uses display notification command)
set searchstrings to {"1:ipad", "2:iphone", "3:ipod", "4:appletv"}
set foldernames to {"iPad Software Updates", "iPhone Software Updates", "iPod Software Updates", "Apple TV Software Updates"}
tell application "Finder" to set itunesfolder to folder "iTunes" of folder "Library" of home as alias
set outputfolder to POSIX path of (choose folder default location itunesfolder)
set searchstrings to choose from list searchstrings with prompt "Download Software for:" with multiple selections allowed
set thedownloads to every paragraph of (do shell script "curl http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version | grep ipsw | sort -u | sed 's/<string>//g' | sed 's/<\\/string>//g' | grep -v protected | grep -i restore")
set urls to {}
repeat with theline in thedownloads
set a to offset of "http" in theline
set urls to urls & {(characters a through -1 of theline) as text}
end repeat
set types to {}
set filenames to {}
set finalurls to {}
repeat with i from 1 to count of urls
set currenturl to (item i of urls) as string
set currentname to do shell script "basename " & quoted form of currenturl
if currentname is not in filenames then
set filenames to filenames & currentname
set AppleScript's text item delimiters to "_"
set current_type to text item 1 of currentname
if types does not contain current_type then
set types to types & current_type
end if
set current_version to text item 2 of currentname
set AppleScript's text item delimiters to "."
set current_version to every text item of current_version
set AppleScript's text item delimiters to ""
set current_version to (current_version as string) as integer
set finalurls to finalurls & {{thetype:current_type, theversion:current_version, theurl:currenturl}}
end if
end repeat
set myoutput to {}
repeat with t in types
set c to 0
repeat with i from 1 to count of finalurls
if (thetype of (item i of finalurls)) as string = t as string then
if (theversion of (item i of finalurls)) > c then
set c to (theversion of (item i of finalurls))
set mu to (theurl of (item i of finalurls))
end if
end if
end repeat
set myoutput to myoutput & mu
end repeat
set togo to count of myoutput
display notification togo & " URLs to go..." as string
repeat with theurl in myoutput
set filename to do shell script "basename " & quoted form of theurl
set thefolder to ""
repeat with searchstring in searchstrings
set folderid to (word 1 of searchstring) as integer
set searchstring to (word 2 of searchstring) as string
if filename contains searchstring then
set thefolder to item folderid of foldernames
end if
end repeat
if thefolder ≠ "" then
try
do shell script "mkdir " & quoted form of outputfolder & quoted form of thefolder
end try
try
set downloadfile to false
set testfile to POSIX file (outputfolder & thefolder & "/" & filename as string) as alias
on error
set downloadfile to true
end try
if downloadfile is true then
do shell script "cd " & quoted form of (outputfolder & thefolder & "/" as string) & ";curl -O " & quoted form of theurl
display notification togo & " URLs to go..." as string
end if
end if
set togo to togo - 1
end repeat
display notification "Finished" as string
Update vom 16.10.2014
Diese XML-Datei mit AWK&CO zu parsen ist etwas abendteuerlich. Deshalb habe ich ein kleines php-Skript geschrieben, welches die Sache dann über eine DOM-Abfrage löst. Zudem wird so auch zuverlässiger die neuste Software-Version geladen
Zudem bietet einem das Script nun auch an die Links in die Zwischenablage zu kopieren, so dass man die Downloads auch über ein anderes Programm (Safari, jDownloader) abarbeiten lassen kann.
Hier direkt eine fertige App, die das im gleichen Ordner befindliche php-Skript zum abrufen der Links nutzt.
Update vom 25.10.2014
- version_compare() wird nun in der PHP-Datei genutzt, um nun die korrekte neuste Version eine Software zu ermittlen (bugfix: da die letzte Version auch veraltete Software-Versionen geladen hat)
- Das AppleScript hat nun eine Version-Prüfung, so dass bei einem erneutem Update eine Meldung angezeigt wird
- Das Skript kann nun veraltete ipws Dateien im Zielordner markieren oder in den Papierkorb verschieben
Update vom 18.11.2015
- Man kann nun ein Speed-Limit vor dem Download der Updates setzen, damit nicht die gesamte Bandbreite für die Updates draufgeht und man das Skript entspannt im Hintergrund laufen lassen kann. Just for You Holger ♥
Klasse Script, aber ich bekomm es nicht zum laufen :( Es lädt immer maximal 1 IPSW, dann passiert stundenlang nix…was mach ich falsch?
Danke schon mal :)
Hallo Markus,
leider bietet einem AppleScript nicht direkt ein GUI mit einem Fortschrittsbalken…. zumindest nicht ohne ein paar Kniffe, die ich noch nicht beherrsche. Nichts desto trotz habe ich gerade eine neue Version online gestellt, die die Download-URL über ein PHP-Skript zusammensucht. Diese Links kannst Du dann auch in die Zwischenablage kopieren lassen und nach belieben mit einem anderen Programm herunterladen lassen.
unter Strich dauert das ganze halt ne Weile… am Ende sind es ja über 65 GB an Daten, die Du thereotische damit von Apples Server laden kannst!