On Sep 21, 2011, at 3:02 PM, Robin Miller wrote: I'm fairly new to packaging, and have been trying to use Stephane Sudre's Packages app to get some software ready for deployment to a number of machines at work.
I would like the package installer to place a .plist file in the ~/Library/Preferences folder for the current user as well as for all other users on the computer. Does this require some post flight scripting or is there a more 'built in' way to handle this (presumably) common situation?
Are you a system-administrator putting things on your users computers (i.e.: computers you will fix yourself when/if you break things)? If not, then I will discourage you from doing this at all. The reasons that software developers should never do this:
1) You don't know how this installer is going to be used out in the field. It could be installed under the administrative user's login, and then used by one or more user.
2) Your installer could be remotely pushed to computers with a tool like ARD, or baked into an image with SIU or InstaDMG. In both of those cases the user that is running the installer may not exist on the computer once imaged.
3) There could well be many users on the system, and there is no good way of getting a complete list that is not going to fail for some cases (users on other volumes, network users, encrypted home folders, etc).
3.1) You installer could never know about new users added after the installer runs.
Note: many of these same problems exist for sys-admins as well, but their screwups in these cases are easier to remediate (i.e.: it is easier for users to yell at them personally). And in those cases a post flight script using 'defaults write' will work for simple cases. For more complex ones I would advise using Python or Ruby and the ObjC scripting bridge.
For software developers the work-around is easy: build the defaults into your application. If you don't get a value from the plists (from Preferences folders in: ~/, /Library, and /Network/Library), then push in a default value. If you do it well you will not ever need to even push these values into any plists unless the user's preferences change from the default.
-- Karl Kuehn |