- This topic has 7 replies, 3 voices, and was last updated 15 years, 10 months ago by
larkost.
-
AuthorPosts
-
June 11, 2009 at 6:04 pm #376426
chops
ParticipantI need to create user directories in the instaDMG build phase in order to populate them with software setup stuff (support files, prefs, etc) with other packages prior to deployment in student labs. createUser.pkg leaves that to first login, but I get messy results that way so I decided to try and get it to create the directories too. Another script I found here creates a user with the associated directory, so I took the directory creation chunk and modified its variables to match those in the postflight script in the createUser.pkg. I ended up with the following lines, which I added to the end of the postflight script (right before exit 0). It works when I launch it on a running Mac, but the directories don’t get created in the instaDMG build process. The users ARE created, just not the directories. What am I doing wrong?
[code]
/bin/mkdir “/Users/${shortname}”
/usr/bin/ditto -rsrcFork /System/Library/User\ Template/English.lproj “/Users/${shortname}”
/usr/sbin/chown -R “${shortname}”:${gid} “/Users/${shortname}”
[/code]June 12, 2009 at 2:15 am #376428larkost
ParticipantThe problem is that you are aiming at “/” so things are being created there. What you need to do in a installer script is aim at “$3/Users/${shortname}” etc…
Note that because of some weird behavior with dscl (it escapes chroot jails) even with the latest version of InstaDMG (the ones that use chroot jails) InstaDMG runs createUser outside of a chroot jail. It is a special case at this point, and with version 2 I hope to find a way around the need for a special case (doing that while keeping compatibility with 10.4 targets is going to take some doing).
June 12, 2009 at 3:04 pm #376434chops
ParticipantOkay, I’ll try it. I’m a little confused though. I saw the ${TARGET_DIR} variable, but in the lines of the original script that create the user there is this one:
[code]$serviceCmd $prefix “$dsNode” $suffix -create $userPath home “/Users/${shortname}”[/code]
which doesn’t have the ${TARGET_DIR} variable or $3 in front of “/Users/${shortname}”. Is this because the $dsNode variable does the pointing?Thanks for your guidance…
June 12, 2009 at 4:07 pm #376438larkost
ParticipantIn the dscl command the $dsNode has the target as part of it. The “/Users/$shortname” bit needs to be absolute because it will be used inside the running OS after it has been installed.
June 13, 2009 at 4:51 am #376440chops
ParticipantThanks, larkost. I tried it and it worked, so now I want to understand it better. I’m obviously not familiar with much of this. Bear with me:
I can conceptualize that the script runs from the target image (volume) even though the machine doing the building of the image is booted from another volume. I’m not understanding how the image being built can have a running OS on it. Is it “running” because the shell command (like mkdir for example) is being run from the image instead of the boot volume? To me that implies that ${TARGET_DIR} or $3 could be placed in front of either the command or the path, as long as one of them has it. Am I on the right track?
June 13, 2009 at 5:46 pm #376441larkost
ParticipantFirst set out a couple of facts:
– The target OS is never booted until well after the ASR image is create.
– Some executables from inside the target volume might get run by post-flight scripts (when run with chroot), but that is not really what we are talking about here.
The “/Users/${shortname}” is used by the target OS after it is booted (as in once you have restored the final image to a disk). This is the value that gets pushed into the DSLocal store. So it needs to be written in as the value that will be used, not the relative position when we are not booted from that volume.
June 18, 2009 at 10:33 pm #376463roeland.de.windt
Participant[QUOTE][u]Quote by: larkost[/u][p] “$3/Users/${shortname}”[/p][/QUOTE]
Where does this $3 come from? are there any others? What do they mean? What do they do?June 18, 2009 at 10:56 pm #376465larkost
ParticipantThere is some good documentation at:
[url]http://s.sudre.free.fr/Stuff/PackageMaker_Howto.html[/url]
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed