I have created an initial version of my createUser.pkg. This is a payload free package that aims to make creating users easily. It uses a configuration file inside the package contents to ease in creating new users. It is was made with the InstaDMG process in mind and should adapt to most uses. It works under both 10.4 AND 10.5. Try it out and see what I missed. The enclosed README should cover things, I hope. Comments are strongly welcome and encouraged.
https://www.afp548.com/filemgmt/index.php?id=70
-Pete-
No one has said it here yet, so I will.
Thank you!
As soon as I get back to work (and back to a mac) I am going to tear this script apart and use it the best I can… I have been waiting for this for a while.
THANK YOU!
😛
This is awesome! I very much appreciate you putting the time and effort in on this!
I have one question- would it be possible to add something to this script to skip the intro movie and setup?
Thanks!
[QUOTE][u]Quote by: mgb123[/u][p] 😛
This is awesome! I very much appreciate you putting the time and effort in on this!
I have one question- would it be possible to add something to this script to skip the intro movie and setup?
Thanks![/p][/QUOTE]
In the Unix spirit of keeping things separate, I have another package for that. It’s really simple since it just creates 2 files. I’ll post it today.
You
are
awesome.
THANK YOU for putting time into this. I fully understand what these scripts are meant to accomplish, but have very little knowledge as to how they work. It’s like forbidden candy or something.
Thanks again for your work!
and now let the fun begin.
Item one, thank you again for this, everything I say here is meant to help, not nit-pick or complain.
2) while looking at the script I noticed that you point out TARGET_DIR=$3 and while I am still learning all of this(proper scripting), I noted from an earlier thread that it might be useful to put it in as “$3” in case people have target volumes with spaces in the names, is this true?
3) Sub 100 UIDs are valid, but you have to be careful as many are taken…. take a look at the list posted at: http://forums.macosxhints.com/showpost.php?p=422085&postcount=6 which gives a listing of used UIDs and GIDs.
4) Many admins need to hide the admin account, so including an option to hide the admin account in the UserData file would be really helpful, it can be done with two lines in the script:
A) as noted by our very own ODMaster ( [url]https://www.afp548.com/forum/viewtopic.php?showtopic=18579&mode=&show=5[/url] ) the first line to add is: [code]defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool YES[/code]
B ) as noted on MacOsXHints ( [url]http://www.macosxhints.com/article.php?story=20080127172157404&query=hide%2Busers%2B10.5[/url] ) [code]sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array $USERNAME[/code] and replace $USERNAME with the account name (short name I think)
5) Some admins need to hide the ‘other’ option at login, for which you can use (from the same MacOsXHints … hint) [code]sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE[/code] this too could be put in as an option.
6) Someone noted above (and in another thread) that adding a user to the admin group, an making it your only user, results in running the movie and registration routine on first boot… getting rid of that should be trivial.
7) Along the lines of items 4 and 5, IF you put in an option to hide the admin account, then it would need to be a sub 500 UID, and it would be best to create the home folder in the /private/var/ location.
8) It may (or may not) be a good idea to have this installer dump down a customized English.lproj (or language of choice) so that new users get specific setups… though I will have mine do it AFTER it creates the admin account. The reason I was thinking its good for inclusion here is that it would keep all portions of user creation in one space, but maybe I am overdoing it)
I am going to play with the script now and see how much of this I can do and post back for someone to fix (my scripting is more vestigial than useful).
Anyway, like I sadi at the top, the script is awesome and I am NOT complaining, just offering suggestions for the next version.
AND… after re-reading thew script but before posting this I noted some mistakes I made, so Items 4 and 5 would need to be in a script that runs at boot OR would need to have their lines added to the requisite prefs files using something other than “defaults write” (should not be an issue). Right now I think I will leave them (for me at least) in a separate script (probably unnecessary, but I will post it).
(Edited to make B) show up as B ) and not a smiley)
[QUOTE][u]Quote by: knowmad[/u][p]and now let the fun begin.
Item one, thank you again for this, everything I say here is meant to help, not nit-pick or complain.
[/QUOTE]
Your welcome. I absolutely welcome comments and criticism, even if its nit-picky. it’s how we all get better.
2) I actually don’t think it’s necessary in this case because we are just assigning the contents of a shell variable. When we actually need to use that variable in an exec, it is enclosed in quotes, but I’ll do it anyway to be consistent.
3) I really don’t want to do any hard coded exclusions and i do want to allow them to add an existing uid if they are mindful of the consequences. Are you suggesting that I allow any uid from 0 on? I could certainly add that and make it more permissive if someone wants to be brave and used uids less than 100. But if I remember correctly that’s explicity a no-no from apple’s perspective.
4) I believe that A belongs in another package since it is secondary to creating the user. I can add B into it since technically it’s part of creating that user.
5) Again, I personally think that global options belong in another package.
6) That IS another package, and I have submitted it to AFP548 and it’s awaiting approval .
7) I will add an option to place the home folder in another location. I think I have that hard coded in now. Great suggestion
8) Are you talking about user profiles? That really needs to be another package. I really want to separate user creation from everything else. If it’s not obvious by now, I’m a unix guy and so we make things that do one thing and one thing only. It’s much more flexible. Especially since many people will be building multiple build trains to adjust to different management needs (labs vs. faculty/staff vs. other. etc), so simply being able to add the right packages is, in my opinion, a better option than having a super package that requires fine tuning for every deployment.
As far as defaults, you were actually right on, except you’d just have to use “$3/Library/Preferences/…” defaults can run on any plist file no matter where it is so using it to set plist files on the target volume is absolutely a valid option. But as I said (and you suggested), those are probably the realm of different scripts. I plan on submitting all of this stuff. Just not part of the same package.
Thanks for you feedback. Keep it coming!
just to clarify re UIDs below 100.
Its probably not a good idea to use them, apple might use what are currently blank uids at a later time. I just noticed that you comment in the script about testing for valid ranges, so i was pointing to a list of used IDs and how they were obtained. As far as I am concerned, as long as I can use an ID sub-500 I am happy.
regarding all else, I understand completely the idea of one script per item, string em together as needed…. I just don’t always follow the logical route.
again, thanks so much for this…. BTW, know any good resources for learning the particulars of dscl? (man pages are typically anemic on details)