-
Notifications
You must be signed in to change notification settings - Fork 197
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
Skip runit installation if already installed #62
Conversation
If there is an executable at the desired installation location, we can assume that runit is already installed. Unfortunately, I can't find a way to verify that the *correct version* is installed, but given that the version isn't configurable via attributes, it seems reasonable that when/if there ever is a new version of runit, this logic can be changed.
Checking that a file is executable isn't very reliable to determine if something is installed. I could It would be better to move the |
Sorry, let me clarify. My problem isn't with the rpm detection, it's that I'm using Chef to converge an image that already has runit installed from source. I.e. there's no way to tell via Most Chef resources have a way to detect if they are already fulfilled by the host OS, and if so, skip doing anything too complex. But, this cookbook will download the source for runit and compile it on rhel systems if https://github.com/opscode-cookbooks/activemq/blob/master/recipes/default.rb#L31 Ultimately, this is just about saving the effort of downloading + building runit every time we converge a new image even though it is already installed on our base image. Not the worst cost, but it would be nice to avoid. Would you be more open to this if it were an attribute, e.g. (Oh, and thanks for the speedy reply!) |
Ah. Thanks for clarifying. I have some ideas... I'll make a branch. |
See the commit message comments in 1d6b6af for an explanation of the helper methods added. Does that work for you? |
Beautiful, thanks a lot for putting that together. I'll give it a try today and I imagine it will do the trick. |
Wow, I totally forgot about this. Sorry about that. Did the helpers from my branch work out for you, @tdooner? |
Is this something that we're ready to merge or is there outstanding tasks or discussion? @jtimberman @tdooner |
Sounds good. I'll close this in favor of #89. Thanks @jtimberman for addressing this. |
If a user is installing runit from source in a base image, as brought up in #62, they probably want to skip the build and installation of the package. We detect that runit is already installed in a robust way: * if the rpm is already installed, keeping the logic we had already * if the `runit` executable is actually executable, AND the `sv` command works (`sv` will return 100 when run with `--help` and have usage information on STDERR.)
If there is an executable at the desired installation location, we can assume that runit is already installed. Unfortunately, I can't find a way to verify that the correct version is installed, but given that the version isn't configurable via attributes, it seems reasonable that when/if there ever is a new version of runit, this logic can be changed.
I don't know how to test this effectively, give the current minitest-based suite. If you have any thoughts I'd be happy to write some tests.
Cheers!