-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: installation without sudo #8715
Conversation
I think it's good practice that users don't need to run `sudo` to install something just to try it out. With this change, the local bin directory is tried first, which usually is also in the `PATH`. This way the installation script can be run without `sudo` and should still work.
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
cmd/ipfs/dist/install.sh
Outdated
@@ -6,7 +6,7 @@ | |||
INSTALL_DIR=$(dirname $0) | |||
|
|||
bin="$INSTALL_DIR/ipfs" | |||
binpaths="/usr/local/bin /usr/bin" | |||
binpaths="$HOME/.local/bin /usr/local/bin /usr/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this at the end of the list so that it's backwards compatible? (i.e. if you run w/ sudo it will continue to put the bin in the same place)
binpaths="$HOME/.local/bin /usr/local/bin /usr/bin" | |
binpaths="/usr/local/bin /usr/bin $HOME/.local/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also will this work if $HOME has a space in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guseggert thanks for the review, the new commit should fix the issues you've mentioned.
Try the `$HOME/.local/bin` path last, so that the script is backwards compatible. Also make sure that it works even if there are spaces in the directory set by `$HOME`.
I think it's good practice that users don't need to run
sudo
to install something just to try it out. With this change, the
local bin directory is tried first, which usually is also in the
PATH
. This way the installation script can be run withoutsudo
and should still work.