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.
--createhome
creates the user's home directory and is largely based on the work and discussion in #14Changes for this option are to the
OptionParser
and creation ofpkg_data
increateuserpkg
,make_config_file
inuserpkg.py
and thepostinstall
scriptThe postinstall script now checks for this option and if found runs:
/usr/sbin/createhomedir -c -u $USERNAME
As discussed in the above pull request, apparently there is no way to use
createhomedir
when not installing to the boot volume, so this all occurs with theif [ "$3" == "/" ]; then
block of the post install script--key
will add the provided public key to~/.ssh/authorized_keys
. Specifying--key
implies--createhome
.Changes for this option are in the same locations as
--createhome
The
postinstall
script will add the key to the user'sauthorized_keys
file, 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 ofeval
which means you need to trust the content of the--key
variable. If there is a safer way to do this that would be a good change.