Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Specify path to user picture #4

Open
ejordansc opened this issue Oct 9, 2017 · 8 comments
Open

Feature request: Specify path to user picture #4

ejordansc opened this issue Oct 9, 2017 · 8 comments

Comments

@ejordansc
Copy link

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 in sysadminctl.

Thanks for considering!

@gregneagle
Copy link
Owner

Would accept a PR...

@ramuntcho
Copy link

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

@gregneagle
Copy link
Owner

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 ?

@ramuntcho
Copy link

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 ?

@gregneagle
Copy link
Owner

No. You'd need to use Xcode and build it yourself.

@ramuntcho
Copy link

Ok, thanks. I have done it.

@Lollaskates
Copy link

Lollaskates commented Mar 28, 2019

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.

@Dragao75
Copy link

Dragao75 commented Oct 9, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants