Open ejordansc opened 7 years ago
Would accept a PR...
Hi,
I wanted to ask the same thing. Here, in Geneva (Switzerland), we used CreateUserPkg for years to create users in our AutoDMG image for public schools. I test your script and it's working very well... but without the image.
What does it mean "a PR" (question from a french guy !!!)
Christian
A PR is a Pull Request. It means that if someone wanted to work on and contribute this functionality, I'd accept it.
@ejordansc @ramuntcho If you want a High Sierra-compatible version of CreateUserPkg, may I point you to https://github.com/gregneagle/CreateUserPkg ?
Thanks for the quick answer. Unfortunately, I do not have the knowledge to do such a work :-((
There is actually no build of this new CreateUserPkg, right ?
No. You'd need to use Xcode and build it yourself.
Ok, thanks. I have done it.
This is actually super easy to bolt on with the way @gregneagle already designed this.
In createuserpkg.py
:
add an import to the top:
from Foundation import NSData
add an additional optional arg:
optional_user_options.add_option(
'--photo', '-P', help='User photo. Path to jpeg file. Optional.')
add to the user_plist conditional section around L122
if options.photo:
try:
user_data['image_data'] = NSData.dataWithContentsOfFile_(options.photo)
except:
print >> sys.stderr, "Could not convert provided photo NSData! (--photo)"
the new photo argument takes a path to a picture.
I can confirm this works! Many thanks!
This is actually super easy to bolt on with the way @gregneagle already designed this. In
createuserpkg.py
:
- add an import to the top:
from Foundation import NSData
- add an additional optional arg:
optional_user_options.add_option( '--photo', '-P', help='User photo. Path to jpeg file. Optional.')
- add to the user_plist conditional section around L122
if options.photo: try: user_data['image_data'] = NSData.dataWithContentsOfFile_(options.photo) except: print >> sys.stderr, "Could not convert provided photo NSData! (--photo)"
the new photo argument takes a path to a picture.
Would be convenient to be able to specify the path to an image that will be used as the user picture, similar to
dscl . append /Users/foo picture "/path/to/image.png"
or the-picture
parameter insysadminctl
.Thanks for considering!