First I apologize for the length and advanced nature of the questions.
I have been editing a script that will configure or create all the files on a disk, post install, to pre-configure it when booted the first time. The idea is to have a post-install configuration script that runs after a NetInstall with disk format (these can be created with System Image Utility).
What I have so far is here:
https://github.com/everetteallen/OSX-No-Boot
This is NOT a first boot script and there is the snag.
The configuration settings normally set by systemsetup, pmset, and createhomedir can not be targeted at a non-booted volume. This narrows me down to the basic tools: defaults, PlistBuddy, dscl, and cat.
Here are my assumptions:
1) we are NOT booted to the volume that is the target of the installer (i.e. we ARE booted from an external disk, netinstall image, key drive, etc or the target volume is on a mounted disk image file)
2) the target volume contains a new, never booted OS X 10.x or newer
3) no first boot script or installer can be used
NOTE: I am not interested in how to get around the assumptions just answers that will work given the assumptions please. I know about First Boot Installer Maker Application and friends but I want avoid the multiple reboots. Besides we should collectively be able to meet the challenge!
So, here are the questions:
a) I need to configure energy saver to never sleep. Normally this would be:
systemsetup -setcomputersleep off
systemsetup -setsleep off
// Restart automatically if the computer freezes or power fails
systemsetup -setrestartfreeze on
systemsetup -setrestartpowerfailure on
systemsetup -setwaitforstartupafterpowerfailure 120
I can see that I need to edit both
/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
and
/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist
Does anyone have working examples of how to make the changes using PlistBuddy or defaults?
2) I need to force custom time server and time zone. Normally this would be:
// Set the time zone
systemsetup -settimezone "America/New_York"
// Enable network time servers
systemsetup -setusingnetworktime on
// Configure a specific NTP server
systemsetup -setnetworktimeserver "time.whatever.domain"
I can:
echo "server time.ncsu.edu" >> /etc/ntp.conf
and cheat a bit with:
defaults write /Library/Preferences/com.apple.timezone.auto Active -bool true
The question is does anyone know what files to write to that will force timezone manually and to use the time server without location services?
3) I want to pre-create the home directories for the 3 users I make with dscl. Normally this would be
createhomedir -c -u someuser
I tried setting the user's NFSHomeDirectory value to $3/Users/$whateveruser but createhomedir -u still did not create and populate the folders. I thought about ditto /System/Library/User Template/English.lproj to /Users/$whateveruser (with appropriate chown/chmods) but that misses the changes I make to /System/Library/User Template/Non_localized for iCloud suppression etc.
Question: Does anyone know how to either a) get createhomdir to work on another volume or b) know the commands to use ditto or cp to pre-populate home directories?
Thanks in advance!