tj/gobinaries

Execute install without sudo

Closed this issue · 5 comments

Prerequisites

  • I searched to see if the issue already exists.

Description

I would like users to be able to install binaries with sudo, I just want to throw the binary in the current working directory.

Fantastic work on this @tj this is going to make a HUGE difference for my project. I want users to get up and running quickly, convincing them to install Go before trying out Pion is sometimes a hurdle :)

Steps to Reproduce

curl -sf https://gobinaries.com/github.com/pion/example-webrtc-applications/twitch | PREFIX='pwd' sh wants root access when it doesn't need it.

Maybe you can make this conditional? sudo being the default still works for me!

Slack

Join us on Slack https://chat.apex.sh/

This is a nice feature to add. Depending on which default is prefered, the script that should be changed is this tj/gobinaries/templates/install.sh#L179

Maybe it could default to sudo and use a NO_SUDO env variable to skip it.

tj commented

Hmm you still get a prompt? I only tested on my Mac and a Linux EC2, but I don't see a password prompt when I install to ..

Maybe the best thing to do would be to check permissions of whatever the destination dir is, then sudo if necessary, and output a nicer message before the prompt saying "hey you don't have permission blah blah" so it's not a surprise password prompt haha

Maybe the best thing to do would be to check permissions of whatever the destination dir is, then sudo if necessary, ...

This would be great!

tj commented

It'll now output something like:

  ==> Downloading github.com/rakyll/hey@master
  ==> Resolved version master to v0.1.3
  ==> Downloading binary for darwin amd64
  ==> Permissions required for installation to /usr/local/bin — alternatively specify a new directory with:
  ==>   $ curl -sf https://gobinaries.com/github.com/rakyll/hey@v0.1.3 | PREFIX=. sh
Password: ...
  ==> Installation complete

Awesome 🎉 Thanks @tj