-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add support for package scripts #19
Comments
LGTM |
Let me know if you need help :D |
@caarlos0 Unfortunately I am not able to start this work for at least the next week. Please go ahead, I look for any updated before I start working |
Any progress? I may have some time on my hands to work on this. A few remarks; if we are to use the structure above, this would imply the same script is used across multiple packagers (rpm, deb ect.). This may not be an immediate problem, but power users may want to take advantage of some explicit features in a maintainer script (e.g. the arguments passed to debian's maintainer scripts). Therefore we may also, in addition to the above structure, allow custom maintainer scripts on a per packager basis. In addition, for simple use cases, I would like to propose a module system. One may be able to draw inspiration from configuration managements tools (like modules in Ansible). This will enable the user to specify maintainer scripts with the use of higher level directives (e.g. creating users, declaring systemd units ect.). The maintainer scripts themselves will be generated by nfpm using packager specific best practices. This relates to solving #15 as well. However I expect this to be of the least priority among the above (and certainly something for the long run). TLDR;
N.B. Sorry for long post 😅 |
Not really :) The info about maintainer scripts on a per packager basis is good to know, I'm not a power user on these things so I usually only have the "common" parts... its good to know power users view on this as well :) About the abstraction, IMHO, while it may be nice, it also may be overkill... maybe in a far future, definitely not soon :P |
seems like the fpm author also tried this init abstraction thing https://github.com/jordansissel/pleaserun
|
I would prefer if we would stick to less abstraction. Including the scripts is straightforward. I can follow the idea where we want some specific scripts for a specific os, but you can easily do this in your bash script, too. I also think package scripts are not necessarily service init scripts and I would like to avoid making any assumptions in goreleaser. Otherwise it does not only need to know about packaging but also os specific behavior. And what happens if some users run a custom init manager? |
that seems like a new and fresh kind of hell 😳 anyway, I agree with your points, less abstraction is definitely simpler! |
Excellent! I agree, the abstraction is a wild and unwieldy idea at this stage. Let that be for another time. About the init files, for clarification, the user would still supply the systemd/upstart/sysvinit files (these are not generated), the maintainer scripts would only make the system aware of them (e.g. I will see if I can find time to work on a fork 👍 |
fwiw, I was curious and just found out some people do indeed write custom init systems. 😰 |
I am currently at a crossroads. Maybe we should follow the structure from OP, but I was thinking we can solve multiple issues at once (in partical #28) and per package scripts as mentioned above. Imagine a structure like this type Config struct {
nfpm.Info
DebInfo nfpm.Info `yaml:"deb"` /* deb overrides */
RPMInfo nfpm.Info `yaml:"rpm"` /* rpm overrides */
} This would allow per package overrides. One can also embed scripts:
preinstall: "./scripts/preinstall.sh" # both deb and rpm
rpm:
scripts:
pretrans: "./scripts/pretrans.sh" # rpm explicit script I was thinking we can use imdario/mergo (to merge configurations) and mitchellh/mapstructure (to dynamically access overrides) avoiding to declare |
Right now the root package is unaware of its implementations... I think it should stay that way. Maybe we can have something like: type Config struct {
Info
Overrides map[string]Info `yaml:"overrides,omitempty"`
} And use it like: scripts:
preinstall: "./scripts/preinstall.sh" # both deb and rpm
overrides:
rpm:
scripts:
pretrans: "./scripts/pretrans.sh" # rpm explicit script What do you think? |
Or maybe even only allow overriding scripts and not all fields (as I don't know if it makes much sense to override other fields) |
There was talk (somewhere) about the dependencies having different names across deb/rpm |
I like the idea of having the |
yeah, I couldn't think of a better name, I'm open to suggestions if you have any...
hmm, havent seen that, also makes sense, maybe we can add that later? |
Yes I will add the hole override implementation in a new PR later if that is okay. Some naming suggestions: package:
deb: ...
rpm: ... The main gist is that I want the |
I think the name depends: Will we enabled overriding "generic" configs? if yes, I'll go with |
Yes I think the user should be able to override the entire config if one wishes so, even if overriding everything makes no sense. Most of the time users will only use few overrides (which is in fact the intended purpose), but they are indeed limitless to override whichever field they like. |
I think we should probably limit what can and what cannot be overridden... IMHO, only things than can be package specific (like scripts and dependencies)... |
Surething. We can probably achieve this with some kind of map: var allowedOverrides map[string]bool I will have a look at this tomorrow |
I noticed that the new feature of pre- und postinstall scripts isn't reflected in the output of the example config file. This commit adds the missing parts to make it clearer that this feature is available. See goreleaser#19
I noticed that the new feature of pre- und postinstall scripts isn't reflected in the output of the example config file. This commit adds the missing parts to make it clearer that this feature is available. See #19
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It would be nice to define scripts similar to fpm. The
.goreleaser.yml
could look like:Happy to help with a PR once we agreed on a way forward
The text was updated successfully, but these errors were encountered: