webi-installers icon indicating copy to clipboard operation
webi-installers copied to clipboard

[Bug] webi is called before it is in the path for some installers

Open coolaj86 opened this issue 4 years ago • 4 comments

We have a catch-22.

We can't soft-add ~/.local/bin to PATH via an export because then the pathman detection would do the wrong - thinking it's already in the PATH (also see discussion about not using pathman at all when something exists in the PATH)

However, it's also possible to install a meta-package that will use webi when it isn't yet in the PATH.

Solution: we export WEBI_CMD and replace all instances of webi xyz with "${WEBI_CMD}" xyz.

_webi/bootstrap.sh:

+ export WEBI_CMD="$HOME/.local/bin/webi"
- "$HOME/.local/bin/webi" "${WEBI_PKG}"
+ "${WEBI_CMD}" "${WEBI_PKG}"

And then there's a half-dozen places or so where we need to do this:

git-config-gpg/git-config-gpg.sh:

- webi gpg-pubkey
+ "${WEBI_CMD}" gpg-pubkey

Who can take this on?

Anyone that understands the basics of how bash variables work... or who can simply follow those instructions.

coolaj86 avatar Nov 24 '21 07:11 coolaj86

${WEBI_CMD:-$HOME/.local/bin/webi} might be better.

i.e. if WEB_CMD is set, use that, else fall back to $HOME/.local/bin/webi

kaihendry avatar Nov 24 '21 07:11 kaihendry

@kaihendry I like that idea. Want to take this on?

coolaj86 avatar Dec 05 '21 05:12 coolaj86

@kaihendry bump

coolaj86 avatar Mar 07 '22 11:03 coolaj86

Why can't it just update the PATH using envman like mentioned upon https://github.com/webinstall/webi-installers#how-webi-works ?

Sorry, I'm re-interpreting this and the solution proposed is to setup a new ENV variable instead of manipulating the existing PATH ENV variable?

kaihendry avatar Mar 12 '22 07:03 kaihendry

@kaihendry You can only export a variable down to a child process. You can't export it up to a parent.

So we need a way to handle the path of webi whether or not its yet in the the global PATH.

coolaj86 avatar Aug 24 '22 03:08 coolaj86

I believe this was fixed a while back.

coolaj86 avatar Aug 24 '22 03:08 coolaj86