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

postinstallcmds can't use commands from the installed software #809

Open
surak opened this issue Jul 7, 2022 · 4 comments
Open

postinstallcmds can't use commands from the installed software #809

surak opened this issue Jul 7, 2022 · 4 comments
Milestone

Comments

@surak
Copy link

surak commented Jul 7, 2022

The example is the following:

I have a software which uses itself to rewrite its configuration files. Let's call this software "straffe" for the sake of example.

During the eb time, I would have a postinstallcmds = ['straffe --hendrik'] to initialize the software.

But this can't happen at postinstallcmds, because straffe cannot be found yet. Installation will fail with "command not found".

It can be done, though, during sanity check. In fact, if I do a sanity_check_commands = ['straffe --hendrik'], it works just fine. Although I am not sure if sanity check is the place for this.

I understand that this is because on the post install, the module of itself is not loaded - which makes sense, so I am not sure what would be a solution here.

@ocaisa
Copy link
Member

ocaisa commented Jul 7, 2022

I guess %(installdir)s/bin/straffe would work, just use that?

@surak
Copy link
Author

surak commented Jul 7, 2022

Fair enough, but do you see an inconsistency between them?

postinstallcmds = ['straffe'] # does not work
sanity_check_commands = ['straffe'] # works

@surak
Copy link
Author

surak commented Jul 7, 2022

Actually, it's worse than that - because if it's just a binary, fine - it will run it - but things like binaries with libraries, or python codes won't, as nothing is on the path.

@boegel boegel added this to the 4.x milestone Jul 9, 2022
@boegel
Copy link
Member

boegel commented Jul 9, 2022

You could work around this by updating $PATH and $LD_LIBRARY_PATH in the command itself:

postinstallcmds = [
    "PATH=%(installdir)s/bin:$PATH LD_LIBRARY_PATH=%(installdir)s/lib:$LD_LIBRARY_PATH straffe --hendrik",
]

I don't think we want to do that automatically though, that could lead to surprises I think...

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

No branches or pull requests

3 participants