Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User home directory not populated until Finder is launched #69

Open
luciusbono opened this issue Jun 24, 2016 · 11 comments
Open

User home directory not populated until Finder is launched #69

luciusbono opened this issue Jun 24, 2016 · 11 comments

Comments

@luciusbono
Copy link

luciusbono commented Jun 24, 2016

I am having a super weird issue.

Building the packer box with the 10.11.5 Installer and all the default packer build settings, folders like the Documents folder are NOT in my vagrant user's home directory:

image

Opening a Finder window will generate the directories, but until I reboot the VM the Documents shortcut icon in Finder is blank

image

I started having this issue with modified version of this build that I've been using internally (all credit given in the documentation), and honestly this has probably been going on for months and I've just ignored it.

I decided to just pull down your build clean and see if the issue persisted and it seems to. The weird thing is that I've build this project a few times, trying different things like skipping updates, and it has generated the home folders a couple of times - but I can't figure out what setting seems to help it along.

It's totally possible that this is expected, but I'm honestly still pretty new to OSX administration. This project has been crucial in helping me learn how to effectively manage OSX clients, I really appreciate you sharing it with us!

Here is all the relevant information I can think of:

Building with the OS 10.11.5 Installer via the latest commit of this project into packer .10.1 and vagrant 1.8.4 into VMWare Fusion Pro 8.1.1 with the vagrant-vmware-fusion plugin (4.0.10)

@luciusbono
Copy link
Author

Looks like this might be expected. Digging around in the CreateUserPKG repo: MagerValp/CreateUserPkg#47

@timsutton
Copy link
Owner

Yes. On an OS X / macOS system a newly-created user will have its home directory auto-created if it's created via the Users & Groups pref pane, but otherwise it's only created upon its first login to the system. This repo's user creation script (part of pkg-postinstall) does pre-create one or two locations as they're needed as part of the provisioning, but otherwise the user dir as a whole isn't set up.

I've actually implemented what was suggested in the above solution in another project that borrows some ideas from this osx-vm-templates repo.. wherein I just copy the English User Template into the new user's directory at the time of the package script. It's been in use for a few months and hasn't caused any issues.

I would be fine with also copying out the User Template to create the user's home dir, except as is indicated in MagerValp/CreateUserPkg#47, there's a question of which locale to copy in. I think realistically, however, defaulting to English.lproj may be fine for the applications of this repo.

@luciusbono
Copy link
Author

luciusbono commented Jun 30, 2016

Thanks for responding - I've been poking at this in my [limited] spare time this week and I'm having trouble implementing the change you mentioned. I'm attempting to include the contents of English.lproj in the veewee-config.pkg to be copied to the created-user's home directory (the root of which I am also creating via the package) and it is not working as expected. I'm just doing a

mkdir -p "$SUPPORT_DIR/pkgroot/Users/$USER"
/bin/cp -Rp "$SUPPORT_DIR/English.lproj/." "$SUPPORT_DIR/pkgroot/$USER/"

And I feel like I'm really missing something basic!

@luciusbono
Copy link
Author

luciusbono commented Jun 30, 2016

Oh, well it would help if I got my paths right. Can you tell its been a long week? Let's try that with:

mkdir -p "$SUPPORT_DIR/pkgroot/Users/$USER"
/bin/cp -Rp "$SUPPORT_DIR/English.lproj/" "$SUPPORT_DIR/pkgroot/Users/$USER"

@timsutton
Copy link
Owner

What you want to do is do this during the postinstall script, something like:

/bin/cp -Rp "$3/System/Library/User Template/English.lproj" "$3/Users/$USER"

The $3 is necessary because you're targeting the volume to which the OS has just been installed on. You can add a line like that somewhere in the pkg-postinstall script and give that a shot!

@luciusbono
Copy link
Author

Oh of course! You're recommending I pull the English.lproj from the VM itself - I don't know why I was expecting to have to pull it up from the project directory, this makes a lot more sense. I will try this out today.

@timsutton
Copy link
Owner

Yes, the idea is you've now just installed the OS, and you're now running whatever tasks can only easily be done from a machine in the same install environment, with a newly-installed OS attached as a non-booted volume.

@luciusbono
Copy link
Author

Well, your suggestion worked great for populating the home folder -- I am still finding that the icon for the Documents folder in Finder is blank until I:

  1. Instantiate the Finder GUI
  2. Reboot

Which seems weird, but I don't suspect will actually cause any real issues for me.

@luciusbono
Copy link
Author

Huh, so, weirdly, there is no Documents folder in English.lproj. WEIRD.

Weird weird weird! It's pretty trivial to make one at the same time I'm copying over English.lproj but I am confused as to why this is, or how the Documents folder really gets made during normal user creation.

@timsutton
Copy link
Owner

Oh, that might be in Non_localized. There's another command called createmobilehome or similar - if you look in that linked AutoDMG PR there's more info about these approaches.

@luciusbono
Copy link
Author

You are correct, it's in Non_localized - the command I found reference to in the PR was createhomedir, which doesn't seem to actually make the documents folder. What I think I'll do is copy in Non-localized first, then copy in English.lproj just for good measure. Seems a little ridiculous, but isn't must more work than just creating the Documents folder manually and may copy over some other important bits. Just trying to make sure my VM user is a decent approximation of a normally-created user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants