From 5a7368029d0728334f36a8db49953eb62b32b845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 12 Nov 2017 20:17:47 +0100 Subject: Delete the correct installation folder when a name is provided --- kerl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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" -- cgit v1.2.3