10.6 Server: Set the appropriate Software Update Server

Oct 21, '09 07:30:00AM

Contributed by: flammable

Snow Leopard only hintWith Mac OS X Server 10.5 and below, Software Update Server only had one catalog of updates -- thus, you could run a command like this one, and have it point Software Update to your server:

defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL "http://Server.local:8088/"

With Mac OS X Server 10.6, Apple has divided the catalog file into three separate catalogs: one for 10.4, one for 10.5, and one for 10.6. Each is a separate URL, and if you set the wrong catalog for the OS, you'll get the (incorrect) message that your software is already up-to-date. Having three separate scripts is a hassle, though, and is prone to error.

On the Hints Forums, users tw and Hal Itosis were instrumental in crafting this AppleScript. It checks the OS that you're currently running, and sets the appropriate Software Update Server URL. Change Server.local to your server's address.

tell application "System Events"
  set OSVersion to do shell script "sw_vers -productVersion"
end tell
if OSVersion starts with "10.4" then
  -- set up Tiger thing
  set catalogURLValue to "http://Server.local:8088/index.sucatalog"
else if OSVersion starts with "10.5" then
  -- set up Leopard thing
  set catalogURLValue to "http://Server.local:8088/index-leopard.merged-1.sucatalog"
else if OSVersion starts with "10.6" then
  -- set up Snow Leopard thing
  set catalogURLValue to "http://Server.local:8088/index-leopard-snowleopard.merged-1.sucatalog"
else
  --bail, because it's panther or less
  return
end if
do shell script "defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL " & catalogURLValue

Bonus hint! Here are a couple of AppleScripts for checking which server is currently set, as well as setting the server back to the default (Apple's). First, to check the current server, use this AppleScript:

set SUServer to do shell script "defaults read /Library/Preferences/com.apple.SoftwareUpdate CatalogURL" display dialog SUServer

And use this AppleScript to reset the Software Update Server:

do shell script "defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL"

Save them as applications, and you can quickly launch them from a flash drive or a network share.

I should note that I realize Workgroup Manager is the official way of pushing the Software Update Server. I work at a Mac repair shop, though, and binding to a directory is not only way overkill for our needs, but introduces all kinds of complications. This is a quick way to update someone's machine without having to download each update via Apple's servers, or install each package manually.

Hope this helps someone!

[robg adds: I haven't tested this one.]

Comments (10)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20091002190708159