Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

Make rustup.sh run sudo itself #2

Open
brson opened this issue Apr 11, 2015 · 3 comments
Open

Make rustup.sh run sudo itself #2

brson opened this issue Apr 11, 2015 · 3 comments

Comments

@brson
Copy link
Contributor

brson commented Apr 11, 2015

There's a lot of code here that would not need to run as root if rustup.sh did the sudo invocation itself, and ~/.rustup would not need to be owned by root.

Some considerations:

  • How to detect when sudo is needed
  • What to do when there's no tty
  • Needs to accommodate non-interactive tools
@lilyball
Copy link
Contributor

This would be great. One downside: even if the script pre-authorizes itself with sudo -v, the download might take long enough (or the timeout set short enough) that the timeout expires before it tries to use sudo to run the actual install.

An alternative approach might instead be instead to simply detect when the script is run with sudo and do most of the work in a child process that has its privileges revoked (sudo -u "#$SUDO_UID" ...), then perform the actual install in the parent once the child indicates that it's performed all of the previous steps.

@PetrGlad
Copy link

PetrGlad commented Jun 3, 2015

I want to install rust into home folder and do not give rustup.sh root rights at all (using --prefix option) Can I do this after such change?

@lilyball
Copy link
Contributor

lilyball commented Jun 3, 2015

@PetrGlad rustup has already adopted this change, and there's a --disable-sudo flag to skip running sudo.

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

No branches or pull requests

3 participants