With the recent package apocalypse I wanted to check that our clients had installed all Apple software updates and not just the ones listed in our local SUS. It was mentioned in the #osx-server irc channel that you can use the --CatalogURL parameter with softwareupdate command.
So I wrote the following simple extended attribute that uses softwareupdate -l and the --CatalogURL parameter to directly query Apples update servers and not the software update servers specified by MCX/JSS etc.
#!/bin/bash
sucheck=`softwareupdate -l --CatalogURL "http://swscan.apple.com/content/catalogs/others/index-lion-snowleopard-leopard.merged-1.sucatalog" | grep -c "Software Update found"`
if [ $sucheck -gt 0 ]; then
echo "<result>Updates</result>"
else
echo "<result>None</result>"
fi