- This topic has 14 replies, 5 voices, and was last updated 16 years, 4 months ago by
mattzago.
-
AuthorPosts
-
December 9, 2008 at 12:59 am #374946
blake
ParticipantI 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,
BlakeDecember 9, 2008 at 7:14 am #374947chilcote
ParticipantHi Blake.
Check /System/Library/CoreServices/Dock.app/Contents/Resources/English.lproj/default.plist.
–joe
December 9, 2008 at 11:35 am #374948alantrewartha
Participantwhat 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!)
December 9, 2008 at 6:22 pm #374953blake
ParticipantThanks 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
December 9, 2008 at 11:45 pm #374958blake
ParticipantI 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 0Blake
December 10, 2008 at 4:31 am #374961Patrick Fergus
ParticipantDo 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
December 10, 2008 at 5:56 pm #374965blake
ParticipantHey 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
December 10, 2008 at 7:44 pm #374967Patrick Fergus
ParticipantIf 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
December 10, 2008 at 7:59 pm #374968blake
ParticipantOk 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.
December 10, 2008 at 9:22 pm #374971blake
ParticipantDid 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.
December 10, 2008 at 9:45 pm #374972Patrick Fergus
ParticipantWhat’s missing?
– Patrick
December 10, 2008 at 10:01 pm #374974blake
ParticipantAt the root of the home these directories are missing…
Documents
Movies
Music
Pictures
Public
SitesA 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.
December 10, 2008 at 10:08 pm #374975Patrick Fergus
ParticipantThen 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
December 10, 2008 at 10:27 pm #374976blake
ParticipantThat’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!
December 15, 2008 at 10:05 pm #374988mattzago
ParticipantSave 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.
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed