nbalonso.com

Hola Reposado!

| Comments

If you have followed the previous tutorial Bye Bye Apple SUS you may be thinking “what just happened?”, yes I have told you what to do on the terminal but you have no confirmation that it actually works.

So before we go ahead and start picking which updates to offer I’ll show you in a graphical way how to verify that it is actually working.

First of all you need to know that the the .htaccess file you added to the root of your web server is incharged of directing each client to the correct catalog depending on which OSX version they’re running.

The approach of this is quite simple, each major OSX version as a different user agent for retrieving the updates. This list below may help you understand

  • Darwin/8 -> 10.4 Tiger
  • Darwin/9 -> 10.5 Leopard
  • Darwin/10 -> 10.6 Snow Leopard
  • Darwin/11 -> 10.7 Lion
  • Darwin/12 -> 10.8 Mountain Lion

“Cut to the chase!” Ok Ok, let everyone see this by himself/herself.

Open Safari and activate the Develop menu if you don’t have it. Click on Develop->User Agent->Other… remove what is currently in use and paste Darwin/11 to emulate a 10.7 catalog request.

Then navigate to http://YourCoolDNSName:8088/index.sucatalog and verify that the string MacOSXUpd10.7.4.pkg exists

Then change the user agent again to Darwin/10 to emulate a 10.6, reload the site and check that the 10.7.4 update is gone but MacOSXUpd10.6.8.pkg does exist now.

So there you go, you have running Apache server offering Apple Updates and with a working re-direction to each catalog.

< /End of previous tutorial validation>

< Start of post really new>

Well as I mentioned on the previous tutorial offering just a mirror of the Apple Updates may have consequences, for instance in my environment the most common machine is an iMac Early 2009 that does not really like the SuperDrive firmware update.

I will use this as an example and offer all the other updates but the SuperDrive firmware.

Navigate to the reposado installation

1
bash-3.2$ cd /Applications/reposado/code/

List the branches and verify that there is none

1
bash-3.2$ ./repoutil --branches

Create a new branch and give it a name

1
bash-3.2$ ./repoutil --new-branch production

Let’s add all the products to the branch and from there we will remove the ones we don’t want

1
2
3
4
5
6
7
8
9
bash-3.2$ ./repoutil --add-product all production

Adding 041-5305 (Multi-Lingual Voices-2.0.0) to branch production...
Building index_production.sucatalog...
Building index-1_production.sucatalog...
Building index-leopard.merged-1_production.sucatalog...
Building index-leopard-snowleopard.merged-1_production.sucatalog...
Building index-lion-snowleopard-leopard.merged-1_production.sucatalog...
Building index-mountainlion-lion-snowleopard-leopard.merged-1_production.sucatalog...

The output above gives you a glimpse of what reposado actually did.

Let’s verify that our new branch have this horrible updates currently added with this command

1
2
3
4
5
bash-3.2$ ./repoutil --list-branch production | grep SuperDrive

061-1807 SuperDrive Firmware Update 1.0 2005-05-03 ['production']
061-2557 SuperDrive Firmware Update 2.0 2006-05-31 ['production']
041-4630 SuperDrive Firmware Update 3.0 2012-03-21 ['production']

The following command will remove this three updates from the production branch and rebuild it (see output for another glimpse)(is not like I actually know what glimpse means but I read it somewhere :) )

1
2
3
4
5
6
7
8
9
10
11
bash-3.2$ ./repoutil --remove-product=061-1807 061-2557 041-4630 production

Removing 061-1807 (SuperDrive Firmware Update-1.0) from branch production...
Removing 041-4630 (SuperDrive Firmware Update-3.0) from branch production...
Removing 061-2557 (SuperDrive Firmware Update-2.0) from branch production...
Building index_production.sucatalog...
Building index-1_production.sucatalog...
Building index-leopard.merged-1_production.sucatalog...
Building index-leopard-snowleopard.merged-1_production.sucatalog...
Building index-lion-snowleopard-leopard.merged-1_production.sucatalog...
Building index-mountainlion-lion-snowleopard-leopard.merged-1_production.sucatalog...

Now verify that they have actually been removed (Yes I do verify a lot)

1
bash-3.2$ ./repoutil --list-branch production | grep SuperDrive

So up to here the basic reposado tasks, now the other part which is making your clients get the production catalog and not the Apple branch how Margarita likes to call it.

For this we need to edit the famous .htaccess file and do a find and replace for $1 to $1_production. In the end will look like this

1
2
3
4
5
6
7
8
9
10
11
12
13
RewriteEngine On
Options FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} Darwin/8
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/index$1_production.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/9
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-leopard.merged-1$1_production.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/10
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-leopard-snowleopard.merged-1$1_production.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/11
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-lion-snowleopard-leopard.merged-1$1_production.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/12
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1$1_production.sucatalog [L]

You could now reload the URi http://YourCoolDNSName:8088/index.sucatalog with any of the user agent on the list and verify that there is no SuperDrive.

You have now the filtering functionality of the Apple SUS service up and running, plus the price of 40€ worth in drinks in your body :)

Make sure you check reposado’s documentation to do more cool stuff

Bonus track:

Because you followed the previous bonus track and you have also margarita, now you can launch the web interface and do the filtering in a more user friendly way.

Screenshot of the result

Also make sure you check our Margarita’s site for more information.

I did not thank the authors of this two great tools on my previous post but I really do thank and admire them.

PS: The icon of the post is because of the meaning of reposado in Spanish.

PS2: An alternative to this with the addition of Netboot and some other stuff would be JAMF’s virtual machine. Make sure you check it out

Comments