Posted on 08-19-2010 02:39 PM
Hi all,
We'd like to create a script that we can run at imaging time that would point our 10.4, 10.5 and 10.6 clients to our internal SUS (xser01), as per Apple KB article HT4069. I checked the Resource Kit, but didn't see anything there that can do this. Anyone know how to create a script that will set the command based on the OS?
10.4: defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://xser01:8088/index.sucatalog
10.5: defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://xser01:8088/index-leopard.merged-1.sucatalog
10.6: defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://xser01:8088/index-leopard-snowleopard.merged-1.sucatalog
The Resource Kit "setTimeServer.sh" and s"etTimeZone.sh" scripts are great...if we can get a "setSoftwareUpdateServer.sh" script, that would be even greater!
:)
Don
Posted on 08-19-2010 02:57 PM
Answered my own question...Google is your friend.
I tested on 10.5 and 10.6, works fine. Hope this makes it into the Resource Kit. :)
Don
-------------------- start -------------------------
#!/bin/bash
#
# Based on info found at:
# http://hints.macworld.com/article.php?story091002190708159
osVersion=sw_vers -productVersion
case $osVersion in
10.4)
catalogURLValue="http://xser01:8088/index.sucatalog"
;;
10.5)
catalogURLValue="http://xser01:8088/index-leopard.merged-1.sucatalog"
;;
10.6)
catalogURLValue="http://xser01:8088/index-leopard-snowleopard.merged-1.sucatalog"
;;
10.[1-3])
exit 1
;;
esac
defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL $catalogURLValue
exit 0;
-------------------- end -------------------------
Posted on 08-19-2010 03:09 PM
A simple case statement can configure this. However you can also do smart groups based on OS, or hardware configurations and then apply the SUS via Mass Edit data in the JSS to the smart group.
example script
#!/bin/bash
OSversion=sw_vers | awk '/ProductVersion/ { print $2 }'
case $OSversion in
10.4.)SUS_SERVER="http://xser01:8088/index.sucatalog";; 10.5.)SUS_SERVER="http://xser01:8088/index-leopard.merged-1.sucatalog";; 10.6.*)SUS_SERVER="http://xser01:8088/index-leopard-snowleopard.merged-1.sucatalog"
esac
defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL ${SUS_SERVER}
exit 0
Posted on 08-19-2010 03:17 PM
arrrrg
I forgot the double semi colons after the last variable set by the case statement.....working 65+ hour weeks does this to me. So, if you test this out make sure you but the ;; after each variable set in the case statement.
sorry for that
Posted on 08-19-2010 03:41 PM
Hey Folks,
It bugged me a bit when I first noticed that Snow Leopard’s SUS required different URLs depending on client OS version. I was pleased when, as of version 7.21, the JSS was updated to handle the OS-specific URLs required by a 10.6 Software Update Server automatically.
If you follow the Patch Management process as described in the QuickStart Guide (link below) you can remove the need for creative scripting solutions.
http://jamfsoftware.com/libraries/pdf/support/QuickStart_Guide_7.3.pdf
I hope this helps.
--
Miles Leacy
Technical Training Manager
Mobile (347) 277-7321
miles at jamfsoftware.com
....................................................................
JAMF Software
1011 Washington Ave. S
Suite 350
Minneapolis, MN 55415
....................................................................
Office: (612) 605-6625
Facsimile: (612) 332-9054
....................................................................
US Support: (612) 216-1296
UK Support +44.(0)20.3002.3907
AU Support +61.(0)2.8014.7469
....................................................................
http://www.jamfsoftware.com
Posted on 08-19-2010 03:49 PM
Hi Miles,
Ok, so all we need to do is create a
Management > Policies > Create policy manually > Packages > Software Update > [x] Set Server
Wow...brilliant!
Thanks,
Don
Posted on 08-20-2010 07:15 AM
Posted on 08-20-2010 09:43 AM
Hey Don,
Just to make sure we're not missing a step...
When using the Set Server option in a Policy or Casper Remote, you need to
be sure you're providing the server data that the client will "set". This
can be done in any of three places in ascending order of precedence...
Network Segment
Individual computer records
Override Defaults in the General tab of the Policy editor
Thanks,
--
Miles Leacy
Technical Training Manager
Mobile (347) 277-7321
miles at jamfsoftware.com
....................................................................
JAMF Software
1011 Washington Ave. S
Suite 350
Minneapolis, MN 55415
....................................................................
Office: (612) 605-6625
Facsimile: (612) 332-9054
....................................................................
US Support: (612) 216-1296
UK Support +44.(0)20.3002.3907
AU Support +61.(0)2.8014.7469
....................................................................
http://www.jamfsoftware.com
Posted on 08-20-2010 09:49 AM
Hi Miles,
Yep, we already had the SUS defined in our LAB environment JSS. I wasn't sure how to point our test Macs to it. In most environments we use the defaults command. So I thought we had to do the same thing in JSS. Glad I don't have to. :)
For testing, here's what I did (SUS is at 10.6 BTW):
I did notice an anomaly, where the 10.5 test Mac didn't seem to have the right URL defined by Apple. The 10.6 test Mac did. I'm not sure it matters since both worked, but wanted to shine a light on it:
10.5 test Mac:
mp01:~ admin$ defaults read /Library/Preferences/com.apple.SoftwareUpdate { AnonymousUUID = "8A8D8BB8-D1E4-48A7-B5C2-5EF6CDD5D1CB"; CatalogURL = "http://xser01.ddcdsm.private:8088/"; LastAttemptDate = 2010-08-20 09:08:25 -0700; LastResultCode = 2; LastSuccessfulDate = 2010-08-20 09:08:25 -0700; } mp01:~ admin$
10.6 test Mac:
mbp01:~ admin$ defaults read /Library/Preferences/com.apple.SoftwareUpdate { CatalogURL = "http://xser01.ddcdsm.private:8088/index-leopard-snowleopard.merged-1.sucatalog"; LastAttemptDate = "2010-08-20 09:06:25 -0700"; LastResultCode = 0; LastSuccessfulDate = "2010-08-20 09:06:25 -0700"; } mbp01:~ admin$
Thanks,
Don
Posted on 08-20-2010 10:15 AM
Thanks Don.
I'll make sure we have a look at this internally.
Miles Leacy
JAMF Software