-
-
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
Refactoring install.sh #3194
Refactoring install.sh #3194
Conversation
3dc0fb3
to
224134b
Compare
License: MIT Signed-off-by: Stephan Kulla <[email protected]>
License: MIT Signed-off-by: Stephan Kulla <[email protected]>
224134b
to
fc20fe8
Compare
fi | ||
for binpath in $binpaths; do | ||
if [ -d "$binpath" ]; then | ||
mv "$bin" "$binpath/$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.
We should check if this succeeds or not and not print 'installed X' if it fails.
In case $binpath/$bin is an already existing directory, the command mv "$bin" "$binpath/$bin" would store the binary in the place $binpath/$bin/$bin. I guess this is not the expected behavior. Therefore I used the -t option of `mv' to specify the target directory explicitly. License: MIT Signed-off-by: Stephan Kulla <[email protected]>
I moved the mv command into the if-condition so that the script only succeeds when mv command ran properly. Thus, there is no need to check whether the mv command will succeed beforehand. License: MIT Signed-off-by: Stephan Kulla <[email protected]>
@whyrusleeping Thanks for your comments! I moved the I also specified the target directory in the Sitenote: Shall |
I think youre right and I wonder how best to convey to the user that they should try running the install with sudo. This script will fail on pretty much all systems the user might run it on as the directories we try never have user level write permissions (for good reasons). |
We have two PRs like that already open: #2936 and #2504. @whyrusleeping I think it would be best to just join them together, if @kulla wants to do it. |
Yes, it would be the best to join the PRs together. When I'll have time I will have a look on the other PRs and try to contribute there... PS: |
It is @whyrusleeping 's call. Also I think #2504 is abandoned so if you would like to take it over and finish it, it would be great but let's wait for @whyrusleeping. |
Arch for example doesn't have |
@Kubuxu I moved my comment to #2504 (comment) 😄 |
I think this PR is on the right path. The others are very complicated, Simplicity is key here. |
Would be nice to detect the write perms fail and ask user to use |
edd9f30
to
c604774
Compare
Show error message that the user shall try running this script with sudo in case write permissions are missing. Implement proposal of comment ipfs#3194 (comment) License: MIT Signed-off-by: Stephan Kulla <[email protected]>
@jbenet Implementation of error message recommending |
Implement proposal of the comment ipfs#2504 (comment) License: MIT Signed-off-by: Stephan Kulla <[email protected]>
Show error message that the user shall try running this script with sudo in case write permissions are missing. Implement proposal of comment ipfs#3194 (comment) License: MIT Signed-off-by: Stephan Kulla <[email protected]>
I removed the comment about using $PATH since it leads to long installation scripts (which violates the KISS principle). Cf. the discussion on ipfs#2504 License: MIT Signed-off-by: Stephan Kulla <[email protected]>
c604774
to
7f194c9
Compare
@kulla just to double check, the |
Yeah. you're right. Concerning https://www.freebsd.org/cgi/man.cgi?query=mv&sektion=1 there is no Done: Changed to |
Return to the old definition of the mv command since there is no `-t` parameter in `mv` of BSD. Cf. https://www.freebsd.org/cgi/man.cgi?query=mv&sektion=1 License: MIT Signed-off-by: Stephan Kulla <[email protected]>
From other thread: use
|
This LGTM @jbenet cant use |
@whyrusleeping yep, saw thanks. LGTM (from my information reference frame, my comment happened before the others, but it was stuck in an email client for hours before reaching the rest of the world.) |
echo "It seems that we do not have the necessary write permissions." | ||
echo "Perhaps try running this script as a privileged user:" | ||
echo | ||
echo " sudo $0" |
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.
yay, good explanation 👍
@kulla thank you so much! This has needed a nice clean update for a while. |
Thanks to all for your comments! 😄 (and btw thanks for the great project!) |
Hello,
I made little changes for the installation script
install.sh
. The enhancements are: