devops-works / binenv

One binary to rule them all. Manage all those pesky binaries (kubectl, helm, terraform, ...) easily.
MIT License
372 stars 44 forks source link

How install app to /usr/local/bin? #104

Closed patsevanton closed 2 years ago

patsevanton commented 3 years ago

Hello! Thanks for binenv. How install app to /usr/local/bin?

leucos commented 3 years ago

Hello; sorry I missed the notification.

There is no real way for now, although it could be interesting.

I guess there are a bunch of other improvements that have a higher priority. Let's keep this open and see how it goes.

leucos commented 2 years ago

FYI currently working on this @patsevanton

patsevanton commented 2 years ago

Hello! Any news?? Can i help for issue?

leucos commented 2 years ago

hello @patsevanton

You can try binenv update && binenv install binenv v0.19.0-rc1 if you feel adventurous :)

This is currently being implemented in https://github.com/devops-works/binenv/tree/global_mode

There is some setup documentation in https://github.com/devops-works/binenv/blob/global_mode/SYSTEM.md

Good luck !

patsevanton commented 2 years ago

How correct install binenv now?

user@EPRUPETW0BA2:~$ binenv update && binenv install binenv v0.19.0-rc2
2022-04-24T11:47:04+06:00 INF retrieving distribution cache from https://raw.githubusercontent.com/devops-works/binenv/develop/distributions/cache.json
2022-04-24T11:47:04+06:00 INF fetched updates for 258 distributions
fetching binenv version 0.19.0-rc2 100% |
2022-04-24T11:47:06+06:00 INF executing self install
2022-04-24T11:47:06+06:00 INF "binenv" (0.19.0-rc2) installed
user@EPRUPETW0BA2:~$ sudo binenv -g install terraform
[sudo] password for user:
sudo: binenv: command not found
leucos commented 2 years ago

The answer should be in the aforementioned documentation (https://github.com/devops-works/binenv/blob/global_mode/SYSTEM.md)

patsevanton commented 2 years ago

Installing binenv to opt is a complication (difficult) of the instruction Can i install binenv to /usr/local/bin by special hand ?

leucos commented 2 years ago

I've made changes to allow installation in /usr/local/bin (and in any directories).

https://github.com/devops-works/binenv/releases/tag/v0.19.0-rc9

By default in global mode, the setup is the following:

Please read the documentation (https://github.com/devops-works/binenv/blob/global_mode/SYSTEM.md) to check some requirements (mainly, set BINENV_GLOBAL=truefor this to work properly).

Use with caution ! This is really alpha. I do tests in containers.

Also note that README install instructions have been changed to point to 0.18.0 (instead of latest) so new users do not install 0.19.0-rcX by accident.

Tell me how it goes.

patsevanton commented 2 years ago

Now is good. I will test and test rc9

leucos commented 2 years ago

I found some regressions in local mode. Will hunt this down asap.

leucos commented 2 years ago

should be fixed in rc10

leucos commented 2 years ago

:warning: FYI rc10 breaks completion of managed binaries that use binary completion shell cobra syntax:

$ which kubectl 
/home/user/.binenv/kubectl
$ kubectl completion bash
...
__start_binenv()
...

binenv completion is returned instead of binary completion.

leucos commented 2 years ago

rc11 is out and should fix this

For the braves out there:

binenv update && binenv install binenv v0.19.0-rc11
patsevanton commented 2 years ago

I install on fresh (clean) WSL

wget -q https://github.com/devops-works/binenv/releases/latest/download/binenv_linux_amd64

wget -q https://github.com/devops-works/binenv/releases/latest/download/checksums.txt
sha256sum  --check --ignore-missing checksums.txt
binenv_linux_amd64: OK
chmod +x ./binenv_linux_amd64
sudo ./binenv_linux_amd64 -g update
2022-04-28T08:52:25+06:00 INF updating distribution list
2022-04-28T08:52:26+06:00 ERR no versions found for distribution "binenv_linux_amd64" (from ./binenv_linux_amd64). Something is really odd.
2022-04-28T08:52:26+06:00 FTL binenv: unable to find proper version for binenv_linux_amd64 ()
sudo ./binenv_linux_amd64 -g install binenv 0.19.0-rc11
2022-04-28T08:52:26+06:00 ERR no versions found for distribution "binenv_linux_amd64" (from ./binenv_linux_amd64). Something is really odd.
2022-04-28T08:52:26+06:00 FTL binenv: unable to find proper version for binenv_linux_amd64 ()
rm ./binenv_linux_amd64
if [[ -n $BASH ]]; then ZESHELL=bash; fi
if [[ -n $ZSH_NAME ]]; then ZESHELL=zsh; fi
echo $ZESHELL
bash
echo "source <(binenv completion ${ZESHELL})" >> ~/.${ZESHELL}rc
exec $SHELL
binenv: command not found
leucos commented 2 years ago

Installation instructions have been fixed.

patsevanton commented 2 years ago
root@homepc:~# binenv -g install terraform
WRN version for "terraform" not specified; using "1.1.9"
fetching terraform version 1.1.9 100% 
INF "terraform" (1.1.9) installed
root@homepc:~# exit
logout

user@homepc:~/infrastructure-as-a-code-example/loki-grafana-java-in-docker$ TF_IN_AUTOMATION=1 terraform init -upgrade
ERR no versions found for distribution "terraform" (from terraform). Something is really odd.
FTL binenv: unable to find proper version for terraform ()
terraform version
INF updating distribution list
ERR no versions found for distribution "terraform" (from terraform). Something is really odd.
FTL binenv: unable to find proper version for terraform ()
leucos commented 2 years ago

As stated in the documentation, you have to use BINENV_GLOBAL=true

Either export BINENV_GLOBAL=true in your rcfile if you mostly want to use a global installation, or use BINENV_GLOBAL=true TF_IN_AUTOMATION=1 terraform init -upgrade in your example.

leucos commented 2 years ago

v0.19.2 is released and adds this feature