aboutsummaryrefslogtreecommitdiffstats
path: root/kerl
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2016-07-20 15:46:54 -0500
committerGitHub <[email protected]>2016-07-20 15:46:54 -0500
commit41b5b28d0977961cd7bd65e520c95edcb012cda7 (patch)
treecd71792ba6a97c446bd94e0c7cdcf18f6231572d /kerl
parent1f78af4823b56e00dc33c9847128450ddf07509f (diff)
parent67e57f73f195c6c769ef86adf00d3a5413ab739f (diff)
downloadkerl-41b5b28d0977961cd7bd65e520c95edcb012cda7.tar.gz
kerl-41b5b28d0977961cd7bd65e520c95edcb012cda7.tar.bz2
kerl-41b5b28d0977961cd7bd65e520c95edcb012cda7.zip
Merge pull request #150 from mazenharake/fix88
Fix issue #88
Diffstat (limited to 'kerl')
-rwxr-xr-xkerl28
1 files changed, 17 insertions, 11 deletions
diff --git a/kerl b/kerl
index 242829d..74df2d1 100755
--- a/kerl
+++ b/kerl
@@ -1009,20 +1009,26 @@ is_valid_install_path()
return 1
fi
+ INSTALLED_NAME=$(get_name_from_install_path $candidate)
+ if [ -n "$INSTALLED_NAME" ]; then
+ echo "ERROR: Installation ($INSTALLED_NAME) already registered for this location ($1)"
+ return 1
+ fi
+
# if the install directory exists,
# do not allow installs into a directory
# that is not empty
if [ -e "$1" ]; then
- if [ -d "$1" ]; then
- count=$(ls -la "$1" | wc -l)
- if [ $count -ne 3 ]; then
- echo "ERROR: $1 does not appear to be an empty directory."
- return 1
- fi
- else
- echo "ERROR: $1 is not a directory."
- return 1
- fi
+ if [ -d "$1" ]; then
+ count=$(ls -la "$1" | wc -l)
+ if [ $count -ne 3 ]; then
+ echo "ERROR: $1 does not appear to be an empty directory."
+ return 1
+ fi
+ else
+ echo "ERROR: $1 is not a directory."
+ return 1
+ fi
fi
return 0
@@ -1122,7 +1128,7 @@ get_active_path()
get_name_from_install_path()
{
if [ -f "$KERL_BASE_DIR"/otp_installations ]; then
- grep -F "$1" "$KERL_BASE_DIR"/otp_installations | cut -d ' ' -f 1
+ grep -m1 -E "$1$" "$KERL_BASE_DIR"/otp_installations | cut -d' ' -f1
fi
return 0
}