aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-11-12 20:17:47 +0100
committerLoïc Hoguin <[email protected]>2017-11-12 20:17:47 +0100
commit5a7368029d0728334f36a8db49953eb62b32b845 (patch)
tree7e0b23ef0eeb47899cacc2fcdc1a5f371dbae4a7
parent5858603f34506da8f075791fcee7d0ff7cc02768 (diff)
downloadkerl-5a7368029d0728334f36a8db49953eb62b32b845.tar.gz
kerl-5a7368029d0728334f36a8db49953eb62b32b845.tar.bz2
kerl-5a7368029d0728334f36a8db49953eb62b32b845.zip
Delete the correct installation folder when a name is provided
-rwxr-xr-xkerl14
1 files changed, 13 insertions, 1 deletions
diff --git a/kerl b/kerl
index 6c6cc89..4d3c761 100755
--- a/kerl
+++ b/kerl
@@ -1587,6 +1587,14 @@ get_name_from_install_path()
return 0
}
+get_install_path_from_name()
+{
+ if [ -f "$KERL_BASE_DIR"/otp_installations ]; then
+ grep -m1 -E "$1$" "$KERL_BASE_DIR"/otp_installations | cut -d' ' -f2
+ fi
+ return 0
+}
+
do_active()
{
ACTIVE_PATH="$(get_active_path)"
@@ -2002,7 +2010,11 @@ case "$1" in
;;
installation)
assert_valid_installation "$3"
- maybe_remove "$3"
+ if [ -d "$3" ]; then
+ maybe_remove "$3"
+ else
+ maybe_remove "$(get_install_path_from_name "$3")"
+ fi
escaped="$(echo "$3" | sed $SED_OPT -e 's#/$##' -e 's#\/#\\\/#g')"
list_remove "$2"s "$escaped"
echo "The installation in $3 has been deleted"