4.16.2012

Mac OS X "SOE" continued

Testing this at the moment, 10.7.x changed the location that server favorites are stored. They used to be .inetloc files in ~/Library/Favorites but now they are stored in a plist array in ~/Library/Preferences/com.apple.sidebarlists.plist

Note though, you can actually add inetloc files into your User Template folder and new users will get them, they just don't get stored as files now when users are manually creating them.
#* Default user preferences.
#+ Add default server favorites in "Connect to Server"
for USER_TEMPLATE in `sudo ls /System/Library/User\ Template`
do
 if [ -r "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences" ]; then
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers dict' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:Controller string CustomListItems' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems array' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:0 dict' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:0:Name string ${server1}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:0:URL string ${server1}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:1 dict' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:1:Name string ${server2}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:1:URL string ${server2}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:2 dict' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:2:Name string ${server3}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
  sudo /usr/libexec/PlistBuddy -c 'Add favoriteservers:CustomListItems:2:URL string ${server3}' "/System/Library/User Template/${USER_TEMPLATE}/Library/Preferences/com.apple.sidebarlists.plist" 
 fi
done

exit 0