Home Forums Software InstaDMG Unraveling the Dock defaults mystery

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #374946
    blake
    Participant

    I have been working on a script that creates user accounts on the first boot of an instaDMG created OS image. One of my remaining challenges is getting the dock items setup properly. I need to match the defaults that apple uses and set them programatically instead of dumping premade preferences into the user home directory.

    The simplest example is on the server version of the OS the server admin tools are added to the dock. I have also seen some iMovie and other ilife items showing in the dock when they are not installed. Does anybody know how apple does this when their setup app creates the users? I expect that they have some tool or script that takes care of this when users are created or at first logon.

    Thanks,
    Blake

    #374947
    chilcote
    Participant

    Hi Blake.

    Check /System/Library/CoreServices/Dock.app/Contents/Resources/English.lproj/default.plist.

    –joe

    #374948
    alantrewartha
    Participant

    what he said ^^

    my preference would be to use MCX (workgroup manager) rather than tamper with files. You can set ‘Once” to manage Dock items for guest machines or a group of users. (if this isn’t appropriate – plz ignore!)

    #374953
    blake
    Participant

    Thanks guys,
    My goal is to not modify any of the system files provided by Apple or change any policies from their defaults. Theses images are created for software testing and any differences between the instaDMG created OS and an install made from the installer DVD are perceived as risky. I don’t want to customize the dock only match the same defaults that apple uses.

    That said I have found some info yesterday..
    This file /Library/Preferences/com.apple.dockfixup.plist appears to hold the data apple uses to cleanup the dock after setup. In my case it would remove the iLife apps from the dock that are not installed.

    This script /System/Library/CoreServices/UserAccountUpdater looks like it’s the one that processes the dock fixup plist.

    I’m going to do some testing to see If I can get this UserAccountUpdater to do what I need today. Any info on how it’s supposed to work is welcome.

    Blake

    #374958
    blake
    Participant

    I still don’t know what the arguments do for this command but it is cleaning up the dock as I needed..
    sudo -u username /System/Library/CoreServices/UserAccountUpdater 0 0 0 0

    Blake

    #374961
    Patrick Fergus
    Participant

    Do I understand what you’re doing? You are trying to:

    1. Create home directories on first startup of an InstaDMG image, but
    2. Trying to deviate as little as possible from an installation from a regular DVD.

    If you’re trying to hammer out a default home directory, why not just put the user’s dslocal record into /var/db/dslocal/nodes/Default/users and let OS X handle the creation of the home directory? It would be difficult to satisfy both #1 and #2 if that’s indeed what you’re doing.

    FWIW, if someone has landed on this thread looking at how to add Dock items and you aren’t using MCX, this may be helpful:

    [url]http://www.macgeekery.com/tips/cli/adding_items_to_the_dock[/url]

    – Patrick

    #374965
    blake
    Participant

    Hey Patrick,
    That is in fact exactly what I’m doing..
    I create the user in /var/db/dslocal/nodes/Default/users using a series of dscl commands. Then ditto over the home directory from the user template. This was leaving some iLife icons in the Dock for applications that are not installed. Running the UserAccountUpdater cleans up these big question mark icons from the dock. Leaving the creation of the home directory up to OS X would result in an incomplete set of files in the home directory.

    I’m very close to accomplishing #1 & #2 at this point. Cleaning up the dock is all that I have left to do. I may use the tip you posted to get the Server Admin tools into the dock on my OS X server images. Unless apple has a standard process for that I can extract from them.

    Blake

    #374967
    Patrick Fergus
    Participant

    If you just place the user’s record in /var/db/dslocal/nodes/Default/users and don’t create a home directory, you’ll get a standard home directory built to Apple’s standards upon first login of the user in question. I’m confused because if you’re trying to satisfy #2 above, wouldn’t adding Server Admin to the Dock deviate from Apple’s standard? What are you trying to do to the home directory?

    But the mechanism that Apple is using to add Server Admin to the Dock in OS X Server is a mystery to me. dockfixup is blank in 10.5 server and the Dock’s default prefs in /System/Library/CoreServices still include references to GarageBand and the rest of iLife.

    – Patrick

    #374968
    blake
    Participant

    Ok interesting,
    I will test not creating the home dir and see what happens. Now that it’s working properly I’m not likely to mess with the script too much. Having the home dir created with the script also allows me to specify the locale and one or two user preferences.

    I’m only looking to add the server admin tools to the dock on os X server images which is what apple does by default.

    #374971
    blake
    Participant

    Did a quick test skipping the creation of the home directory. When you login it does create a home directory and populates some of the files but not the full set you see normally.

    #374972
    Patrick Fergus
    Participant

    What’s missing?

    – Patrick

    #374974
    blake
    Participant

    At the root of the home these directories are missing…
    Documents
    Movies
    Music
    Pictures
    Public
    Sites

    A good number of files from the ~/Library folder are also missing. Doesn’t look like anything very critical but OS X doesn’t clone out the files from /System/Library/User Template/Language.lproj for you.

    #374975
    Patrick Fergus
    Participant

    Then there is something unusual going on. Are you creating a home [i]folder[/i] but no subfolders? OS X assumes that if a home [i]folder[/i] exists in the “correct” spot (usually /Users/shortname), that the home has already been copied from the User Template.

    – Patrick

    #374976
    blake
    Participant

    That’s totally what’s happening here. A second script we use has already created the folder first and stuck a launch agent in it..

    Without knowing when the home directory is created during the boot process it would be fairly difficult to know exactly when you can change any files in it. I may re-work this script to let OS X create the home directory if I can sort out the timing, configuring localization & if it correctly sets up the dock on OS X server..

    Thanks for the info Patrick!

    #374988
    mattzago
    Participant

    Save yourself a lot of headaches and throw dockutil on your builds. It is program that is very very easy to script to change a dock It is available at: http://code.google.com/p/dockutil/. It has great syntax and you can alter stack views, dock icon positions, and a lot of other things.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Comments are closed