Skip to content

Conversation

garnierclement
Copy link
Contributor

Hi timsutton, pkgbuild has a useful option --scripts to add some pre and post install scripts.
Thus it can be used to customize the generated packages. I made few changes to make it work.

@timsutton
Copy link
Owner

Thanks! A few comments:

Could you also ensure that any files named preinstall and postinstall have executable permissions set? (pkgutil doesn't handle this for us) Perhaps if the directory doesn't include either of these, it should output a warning.

It would be useful if we clarify in the usage that --scripts is just literally passing the option through to the pkgbuild command. This would at least be a hint to users to look at pkgbuild for more documentation.

Also, since adding --scripts only changes one line in the call to pkgbuild, it would be better if we don't duplicate the entire command with its options - just conditionally add the --scripts line and build the rest of it.

@garnierclement
Copy link
Contributor Author

Thanks for your feedback. I made the changes according to your comments. As I've never write Ruby before today, there might be some better ways to do it but it seems to work fine.

@garnierclement
Copy link
Contributor Author

Also when installing software with brew, brew does not require root credentials. But here when packaging with brew-pkg and then installing the package, the root user owns the installed files. To change this behavior, we can add the --ownership option set to the value preserve (see my last commit).

@timsutton
Copy link
Owner

This is true - but in my opinion the value of installer packages is that they're for installing software to the system. I wrote brew-pkg to be able to generate packages that I deploy to other systems, and as far as I'm concerned those packges should install files owned by root.

It's usually a bad sign if an installer package installs something to /usr/local owned by a UID like 501 - 501 may not necessarily even exist on a system, but we can count on the fact that root:wheel or :admin will.

Reverts back to the previous default behavior and add custom ownership
as an option
@garnierclement
Copy link
Contributor Author

You're right about that. And it is better if brew-pkg stays consistent with the previous behavior (implicitly recommended).
As a compromise, I simply added an --ownership option that is again passed through to pkgbuild (of course, only valid values recommended, preserve or preserve-other will be passed).

@timsutton timsutton merged commit 5b630de into timsutton:master Aug 1, 2014
@timsutton
Copy link
Owner

Thanks! Just released 0.1.5 to incorporate these.

@garnierclement
Copy link
Contributor Author

Nice ! Glad to contribute =)

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

Successfully merging this pull request may close these issues.

2 participants