gon icon indicating copy to clipboard operation
gon copied to clipboard

Suggestion: allow passing extra flags to create-dmg

Open andreparames opened this issue 6 years ago • 3 comments

Hi! Thanks for this tool, it works great!

We just have a small issue: when it calls create-dmg, that tool tries to launch Finder to generate a .DS_Store file, but since I'm running it on a headless machine, it fails. The solution is to call it with the --skip-jenkins flag to avoid running Finder, and just bundle the file manually.

This is to say: it would be great if we could pass that flag to create-dmg from gon. I'd be happy to write a PR, but I'm wondering if you are OK with accepting that extra feature. My idea was to add an extra_args key in the dmg setting, like:

"dmg" :{
        "output_path":  "terraform.dmg",
        "volume_name":  "Terraform",
       "extra_args": "--skip-jenkins --icon-size 128"
    }

what do you think?

andreparames avatar Nov 20 '19 23:11 andreparames

My hesitation with this is that it forces us to use create-dmg forever. I don't have any plans not to but say a Go-native way to create DMGs existed (it doesn't, it probably won't), we couldn't switch because we hard depend on create-dmg. However, create-dmg is also a very active and full featured project so would we ever realistically switch? Maybe not.

So, if we went with this, my recommendation would be to make extra_args a list of strings so we don't have to deal with shell parsing or anything and we can pass as-is to fork/exec.

mitchellh avatar Nov 21 '19 00:11 mitchellh

Hi, sorry for not coming back to this. We've decided to switch to using codesign directly, then appdmg to create the package, and finally gon for notarizing. Mostly because we wanted some extra control over the creation of the dmg (such as using a custom background image).

I guess this basically validates your concerns about becoming too tied to a dmg creation tool. I wondered if there was any way of making gon fully agnostic to the tool, but didn't come to any good solution.

andreparames avatar Dec 18 '19 11:12 andreparames

I guess this basically validates your concerns about becoming too tied to a dmg creation tool. I wondered if there was any way of making gon fully agnostic to the tool, but didn't come to any good solution.

Maybe there could be a preference called something like command_override and some env vars to declare the parameters and you just set it, like:

"dmg" :{
        "output_path":  "terraform.dmg",
        "command_override": "appdmg ./appdmg.conf.json $DMG_OUTPUT_PATH"
    }

and then it just treats it as a success based on the returncode being 0 or not.

Thoughts? (I'm willing to contribute the PR.)

darkvertex avatar Apr 30 '21 01:04 darkvertex