arkade icon indicating copy to clipboard operation
arkade copied to clipboard

[Git Bash] Arkade get OSM path errors

Open nunix opened this issue 4 years ago • 12 comments

Expected Behaviour

On Windows Git Bash, when running ark get osm, the last two commands should be able to run on Git Bash with errors. The commands should be adapted as follow:

chmod +x C:/Users/corsair/AppData/Local/Temp/osm.exe
install -m 755 C:/Users/corsair/AppData/Local/Temp/osm.exe /usr/bin/osm.exe

OR

chmod +x C:\\Users\\corsair\\AppData\\Local\\Temp\\osm.exe
sudo install -m 755 C:\\Users\\corsair\\AppData\\Local\\Temp\\osm.exe /usr/bin/osm.exe

Current Behaviour

The current commands displayed at the end of ark get osm will generate the follow errors: chmod +x C:\Users\corsair\AppData\Local\Temp/osm.exe image

sudo install -m 755 C:\Users\corsair\AppData\Local\Temp/osm.exe /usr/local/bin/osm.exe (and without sudo) image

Possible Solution

As stated in the "Expected behaviour", the output commands should be updated for Git Bash

Steps to Reproduce (for bugs)

  1. Install Git Bash for Windows: https://gitforwindows.org/
  2. Install Arkade for Git Bash: https://github.com/alexellis/arkade#get-arkade
  3. Run ark get osm
  4. Run chmod +x C:\Users\corsair\AppData\Local\Temp/osm.exe
  5. Run sudo install -m 755 C:\Users\corsair\AppData\Local\Temp/osm.exe /usr/local/bin/osm.exe

Context

Testing Arkade on Git Bash as discussed with @alexellis

Your Environment

  • What Kubernetes distribution are you using? Docker Desktop for Windows Kubernetes
kubectl version

v1.18.6 image

  • Operating System and version (e.g. Linux, Windows, MacOS): Windows 10
uname -a

cat /etc/os-release

N/A

  • What arkade version is this?
arkade version

0.6.0 image

nunix avatar Aug 06 '20 20:08 nunix

Thank you for the issue. arkade install Pam/linkerd works as expected though?

alexellis avatar Aug 06 '20 20:08 alexellis

no problem, and I will test the other 2 you're mentioning. But before that, I do confirm that ark install osm works fine: image image

nunix avatar Aug 06 '20 20:08 nunix

ark install linkerd ends in error indeed: image

nunix avatar Aug 06 '20 21:08 nunix

Thank you for the detailed report Nuno.

So for Git Bash we primarily need to work on arkade get

For Git Bash users only:

  • Suggest copying to /usr/bin/ instead of /usr/local/bin/
  • Remove suggestion of sudo

alexellis avatar Aug 07 '20 08:08 alexellis

@alexellis I'm trying to figure out if the user is running Git Bash. So far I can think of:

  • Checking if the OS is Windows
  • The "EXEPATH" env variable by default is set to "C:\Program Files\Git" (this could be used too) What do you reckon?

kadern0 avatar Aug 10 '20 08:08 kadern0

There's code already that detects the client OS and architecture - you should see it in the codebase, search for "mingw", we can use that. (And yes this applies only to Git Bash on Windows)

alexellis avatar Aug 10 '20 09:08 alexellis

for Windows, you might want to check the kernel as it's different for Git Bash and WSL2:

  • Git bash image

  • WSL2 image

For WSL1, I'm not currently running any distro but the kernel would be 4.x with a Microsoft reference

Hope this helps to provide an hint at least.

nunix avatar Aug 10 '20 12:08 nunix

Thanks for the additional input. We already have code to determine Git Bash (please see my previous comment)

https://github.com/alexellis/arkade/blob/master/pkg/env/env.go#L16

https://github.com/alexellis/arkade/issues/169#issuecomment-671240988

alexellis avatar Aug 10 '20 12:08 alexellis

haha, sorry for redundency 😅 then I'll wait for testing it once a first pre-release it out 👍

nunix avatar Aug 10 '20 13:08 nunix

@nunix please could you confirm if this is still an issue?

alexellis avatar Apr 16 '21 09:04 alexellis

@nunix please could you confirm if this is still an issue?

Double that, this issue still stands @nunix?

Shikachuu avatar Aug 12 '22 15:08 Shikachuu

Hi all,

really sorry for missing this issue (long time didn't use Git Bash). So the good news is that the osm binary is correctly copied to $HOME/.arkade/bin, however the listing of commands from the Arkade install are still not OK (read: we cannot copy/paste them and it works).

Here's the installation output image

The output, as mentioned above, should replace the single \ by / or \\ or, you could leverage the Git Bash $HOME variable as it shows a *nix path: image

image

Finally, as said above, there's no sudo in Git Bash, so the last command (adding to /usr/local/bin will not work). Instead Git Bash should run in "Administrator" mode and the end path should be /usr/bin as /usr/local doesn't exist: image

Hope this helps, and I'll monitor this issue if any feedback is needed.

nunix avatar Aug 13 '22 11:08 nunix