-
Notifications
You must be signed in to change notification settings - Fork 23
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
Existing Installation Detection Enhancements #54
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
# Sanity checks | ||
|
||
echo "Validating installation location..." | ||
if [ -e "$SDKMAN_DIR" ] && [ ! -d "$SDKMAN_DIR" ]; then | ||
echo "Cannot install to requested location." | ||
echo "" | ||
echo "======================================================================================================" | ||
echo " A file of the same name as the installation directory exists." | ||
echo " File in conflict is:" | ||
echo "" | ||
echo " ${SDKMAN_DIR}" | ||
echo "" | ||
echo " Restart after removing the existing file or choosing a different installation location." | ||
echo "======================================================================================================" | ||
echo "" | ||
exit 1 | ||
fi | ||
|
||
echo "Looking for a previous installation of SDKMAN..." | ||
if [ -d "$SDKMAN_DIR" ]; then | ||
if [ -d "$SDKMAN_DIR" ] && [ ! -z $(ls -A "$SDKMAN_DIR") ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would an empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put a detailed explanation of why the ability to install into an existing, empty directory is necessary here: #53 Check out the "Why does this matter?" heading. Short story is, allows unprivileged users to install in privileged locations. |
||
echo "SDKMAN found." | ||
echo "" | ||
echo "======================================================================================================" | ||
|
@@ -84,4 +100,4 @@ else | |
echo "" | ||
exit 1 | ||
fi | ||
fi | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,11 @@ SDKMAN_VERSION="@cliVersion" | |
SDKMAN_PLATFORM=$(uname) | ||
|
||
if [ -z "$SDKMAN_DIR" ]; then | ||
SDKMAN_DIR="$HOME/.sdkman" | ||
SDKMAN_DIR=$(readlink -f "$HOME/.sdkman") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we are going to allow these changes, they should only be done in the beta hook until we can verify that they work on all platforms in the beta channel. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if |
||
SDKMAN_DIR_RAW='$HOME/.sdkman' | ||
else | ||
SDKMAN_DIR_RAW="$SDKMAN_DIR" | ||
SDKMAN_DIR=$(readlink -f $SDKMAN_DIR) | ||
fi | ||
|
||
# Local variables | ||
|
@@ -136,4 +137,4 @@ fi | |
|
||
} | ||
|
||
@includes.install_message(beta) | ||
@includes.install_message(beta) |
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.
I really don't see why we should check for the presence of a file here. This seems like a very odd situation to be in and perhaps something that you've gotten yourself into by accidentally touching a file called
~/.sdkman
. This seems highly unlikely to ever happen out in the wild and feels over-defensive to me.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.
I understand the concern, just offering it up while I was in making enhancements. The installer makes a lot of assumptions about the availability of the installation directory and throws all sorts of errors if there is a file in the way. It's obviously your call, but what's the harm in better testing that is simple?