Posted on 12-06-2013 02:46 AM
Hey guys,
I got stuck with this problem. Customer is running a NetSUS 2.0 with two branches on it. (e.g. http://1.2.3.4/content/catalogs/index_root.sucatalog)
If I point clients directly to this URL, the sucatalog will not be found. On github I found that you have to create a .htaccess file in the root of the Reposado repository with the following contents:
RewriteEngine On
Options FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} Darwin/8
RewriteRule ^index(.).sucatalog$ content/catalogs/index$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/9
RewriteRule ^index(.).sucatalog$ content/catalogs/others/index-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/10
RewriteRule ^index(.).sucatalog$ content/catalogs/others/index-leopard-snowleopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/11
RewriteRule ^index(.).sucatalog$ content/catalogs/others/index-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/12
RewriteRule ^index(.).sucatalog$ content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/13
RewriteRule ^index(.).sucatalog$ content/catalogs/others/index-10.9-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
All right so far, I placed this in /src/SUS/html, restarted apache2 and nothing happend. When doing a "curl --user-agent "Darwin/12.5.0" http://1.2.3.4/content/catalogs/index_root.sucatalog" on the server, following answer is returned:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /content/catalogs/index_root.sucatalog was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at 10.145.6.25 Port 80</address>
</body></html>
So, I got stuck on this place. I created a .htaccess in multiple subdirectories of /srv/SUS/* but nothing changed.
Any hints on this? It's not practicable to redirect every OS to another SUS URL manually…
Thanks! :)
Posted on 12-06-2013 04:06 AM
I did originally look into this as a solution but found it to be unnecessary after writing a simple script to detect the OS and write the relevant sucatalog. I just deploy this one script to every Mac and voila. Apologies as this is not a solution to your actual question but rather a different approach. Ive been using this method for some time and have not had any issues with it so figured it might be worth a mention.
#!/bin/bash
os=$(sw_vers | grep ProductVersion | awk -F " " '{ print $2 }' | cut -d . -f1 -f2)
case "${os}" in
10.5)
defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://*yourserver*:80/content/catalogs/others/index-leopard.merged-1_*yourbranch*.sucatalog
;;
10.6)
defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://*yourserver*:80/content/catalogs/others/index-leopard-snowleopard.merged-1_*yourbranch*.sucatalog
;;
10.7)
defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://*yourserver*:80/content/catalogs/others/index-lion-snowleopard-leopard.merged-1_*yourbranch*.sucatalog
;;
10.8)
defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://*yourserver*:80/content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1_*yourbranch*.sucatalog
;;
*)
echo "OS not currently supported by this NetSUS, speak to your Administrator to add the new OS sucatalog"
;;
esac
Posted on 12-06-2013 09:30 AM
Here's my documentation when I did it back on NetSUS 1.02; should be the same for NetSUS 2.0:
Enable mod_rewrite:
Modify the apache2 config file:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
Create an .htaccess file:
RewriteEngine On
Options FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} Darwin/8
RewriteRule ^index(.*).sucatalog$ content/catalogs/index$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/9
RewriteRule ^index(.*).sucatalog$ content/catalogs/others/index-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/10
RewriteRule ^index(.*).sucatalog$ content/catalogs/others/index-leopard-snowleopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/11
RewriteRule ^index(.*).sucatalog$ content/catalogs/others/index-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/12
RewriteRule ^index(.*).sucatalog$ content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/13
RewriteRule ^index(.*).sucatalog$ content/catalogs/others/index-10.9-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
Restart the apache2 service:
sudo service apache2 restart
You should now be able to point all of your clients to http://{NetSUSaddress}/index{BranchName}.sucatalog* and it will automatically go to the appropriate version-specific catalog file
More info:
EDIT - you made me realize I didn't update my documentation after Mavericks came out. Added a line to the htaccess file to account for the Mavericks catalog :)
Posted on 12-11-2013 04:37 AM
Thanks for your answers!
@wyip: Unfortunately this does not work for me. Still the same errors as before. We've got much to do with Mavericks at the moment, so this will have to wait a bit longer.
@richmac: this one worked for me. I had a very similar script before, but your script takes care of multiple OS's, so I'm going to use this one.
Again, thanks to you guys!