Add two options --createhome and --key #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
--createhomecreates the user's home directory and is largely based on the work and discussion in #14Changes for this option are to the
OptionParserand creation ofpkg_dataincreateuserpkg,make_config_fileinuserpkg.pyand thepostinstallscriptThe postinstall script now checks for this option and if found runs:
/usr/sbin/createhomedir -c -u $USERNAMEAs discussed in the above pull request, apparently there is no way to use
createhomedirwhen not installing to the boot volume, so this all occurs with theif [ "$3" == "/" ]; thenblock of the post install script--keywill add the provided public key to~/.ssh/authorized_keys. Specifying--keyimplies--createhome.Changes for this option are in the same locations as
--createhomeThe
postinstallscript will add the key to the user'sauthorized_keysfile, creating it (and~/.ssh) if it doesn't exist. It will also set permissions on the file/directory. These commands are run as the created user in order to expand~and pick up the user's GID when the files are created. This seems to require the use ofevalwhich means you need to trust the content of the--keyvariable. If there is a safer way to do this that would be a good change.